From ea18354705c0e10413db213ec7a9a140cb623d91 Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 22 Apr 2020 06:55:35 +0100 Subject: [PATCH] Revert a few things regarding CarlaProcessUtils Signed-off-by: falkTX --- source/backend/utils/System.cpp | 4 ---- source/bridges-ui/CarlaBridgeFormat.cpp | 1 - source/jackbridge/JackBridge2.cpp | 2 +- source/libjack/libjack.cpp | 1 - source/utils/CarlaProcessUtils.cpp | 28 ------------------------- source/utils/CarlaProcessUtils.hpp | 27 ++++++++++++++++++++++-- 6 files changed, 26 insertions(+), 37 deletions(-) diff --git a/source/backend/utils/System.cpp b/source/backend/utils/System.cpp index a6cd0cb3d..3bd3ba5f0 100644 --- a/source/backend/utils/System.cpp +++ b/source/backend/utils/System.cpp @@ -39,7 +39,3 @@ void carla_set_process_name(const char* name) } // ------------------------------------------------------------------------------------------------------------------- - -#include "CarlaProcessUtils.cpp" - -// ------------------------------------------------------------------------------------------------------------------- diff --git a/source/bridges-ui/CarlaBridgeFormat.cpp b/source/bridges-ui/CarlaBridgeFormat.cpp index 7f02739e6..a899cb4b4 100644 --- a/source/bridges-ui/CarlaBridgeFormat.cpp +++ b/source/bridges-ui/CarlaBridgeFormat.cpp @@ -344,6 +344,5 @@ void CarlaBridgeFormat::exec(const bool showUI) CARLA_BRIDGE_UI_END_NAMESPACE #include "CarlaPipeUtils.cpp" -#include "CarlaProcessUtils.cpp" // --------------------------------------------------------------------- diff --git a/source/jackbridge/JackBridge2.cpp b/source/jackbridge/JackBridge2.cpp index c89ef1ede..59b046de8 100644 --- a/source/jackbridge/JackBridge2.cpp +++ b/source/jackbridge/JackBridge2.cpp @@ -19,7 +19,7 @@ #ifdef JACKBRIDGE_DUMMY # include "CarlaUtils.hpp" #else -# include "CarlaProcessUtils.cpp" +# include "CarlaProcessUtils.hpp" # include "CarlaSemUtils.hpp" # include "CarlaShmUtils.hpp" #endif // ! JACKBRIDGE_DUMMY diff --git a/source/libjack/libjack.cpp b/source/libjack/libjack.cpp index 24d80e595..d45dacc86 100644 --- a/source/libjack/libjack.cpp +++ b/source/libjack/libjack.cpp @@ -1395,7 +1395,6 @@ pthread_t jack_client_thread_id(jack_client_t* client) #include "jackbridge/JackBridge2.cpp" #include "CarlaBridgeUtils.cpp" -#include "CarlaProcessUtils.cpp" // --------------------------------------------------------------------------------------------------------------------- // TODO diff --git a/source/utils/CarlaProcessUtils.cpp b/source/utils/CarlaProcessUtils.cpp index 806dd5537..3d609c60f 100644 --- a/source/utils/CarlaProcessUtils.cpp +++ b/source/utils/CarlaProcessUtils.cpp @@ -17,34 +17,6 @@ #include "CarlaProcessUtils.hpp" -#ifdef CARLA_OS_LINUX -# include -#endif - -// -------------------------------------------------------------------------------------------------------------------- -// process functions - -void carla_setProcessName(const char* const name) noexcept -{ - CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0',); - -#ifdef CARLA_OS_LINUX - ::prctl(PR_SET_NAME, name, 0, 0, 0); -#endif -} - -void carla_terminateProcessOnParentExit(const bool kill) noexcept -{ -#ifdef CARLA_OS_LINUX - // - ::prctl(PR_SET_PDEATHSIG, kill ? SIGKILL : SIGTERM); - // TODO, osx version too, see https://stackoverflow.com/questions/284325/how-to-make-child-process-die-after-parent-exits -#endif - - // maybe unused - return; (void)kill; -} - // -------------------------------------------------------------------------------------------------------------------- // process utility classes diff --git a/source/utils/CarlaProcessUtils.hpp b/source/utils/CarlaProcessUtils.hpp index 9d28f5d81..468c75567 100644 --- a/source/utils/CarlaProcessUtils.hpp +++ b/source/utils/CarlaProcessUtils.hpp @@ -25,18 +25,41 @@ # include #endif +#ifdef CARLA_OS_LINUX +# include +#endif + // -------------------------------------------------------------------------------------------------------------------- // process functions /* * Set current process name. */ -void carla_setProcessName(const char* const name) noexcept; +static inline +void carla_setProcessName(const char* const name) noexcept +{ + CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0',); + +#ifdef CARLA_OS_LINUX + ::prctl(PR_SET_NAME, name, 0, 0, 0); +#endif +} /* * Set flag to automatically terminate ourselves if parent process dies. */ -void carla_terminateProcessOnParentExit(const bool kill) noexcept; +static inline +void carla_terminateProcessOnParentExit(const bool kill) noexcept +{ +#ifdef CARLA_OS_LINUX + // + ::prctl(PR_SET_PDEATHSIG, kill ? SIGKILL : SIGTERM); + // TODO, osx version too, see https://stackoverflow.com/questions/284325/how-to-make-child-process-die-after-parent-exits +#endif + + // maybe unused + return; (void)kill; +} // -------------------------------------------------------------------------------------------------------------------- // process utility classes