Signed-off-by: falkTX <falktx@falktx.com>tags/v2.2.0-RC1
@@ -39,7 +39,3 @@ void carla_set_process_name(const char* name) | |||||
} | } | ||||
// ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- | ||||
#include "CarlaProcessUtils.cpp" | |||||
// ------------------------------------------------------------------------------------------------------------------- |
@@ -344,6 +344,5 @@ void CarlaBridgeFormat::exec(const bool showUI) | |||||
CARLA_BRIDGE_UI_END_NAMESPACE | CARLA_BRIDGE_UI_END_NAMESPACE | ||||
#include "CarlaPipeUtils.cpp" | #include "CarlaPipeUtils.cpp" | ||||
#include "CarlaProcessUtils.cpp" | |||||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- |
@@ -19,7 +19,7 @@ | |||||
#ifdef JACKBRIDGE_DUMMY | #ifdef JACKBRIDGE_DUMMY | ||||
# include "CarlaUtils.hpp" | # include "CarlaUtils.hpp" | ||||
#else | #else | ||||
# include "CarlaProcessUtils.cpp" | |||||
# include "CarlaProcessUtils.hpp" | |||||
# include "CarlaSemUtils.hpp" | # include "CarlaSemUtils.hpp" | ||||
# include "CarlaShmUtils.hpp" | # include "CarlaShmUtils.hpp" | ||||
#endif // ! JACKBRIDGE_DUMMY | #endif // ! JACKBRIDGE_DUMMY | ||||
@@ -1395,7 +1395,6 @@ pthread_t jack_client_thread_id(jack_client_t* client) | |||||
#include "jackbridge/JackBridge2.cpp" | #include "jackbridge/JackBridge2.cpp" | ||||
#include "CarlaBridgeUtils.cpp" | #include "CarlaBridgeUtils.cpp" | ||||
#include "CarlaProcessUtils.cpp" | |||||
// --------------------------------------------------------------------------------------------------------------------- | // --------------------------------------------------------------------------------------------------------------------- | ||||
// TODO | // TODO | ||||
@@ -17,34 +17,6 @@ | |||||
#include "CarlaProcessUtils.hpp" | #include "CarlaProcessUtils.hpp" | ||||
#ifdef CARLA_OS_LINUX | |||||
# include <sys/prctl.h> | |||||
#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 | // process utility classes | ||||
@@ -25,18 +25,41 @@ | |||||
# include <csetjmp> | # include <csetjmp> | ||||
#endif | #endif | ||||
#ifdef CARLA_OS_LINUX | |||||
# include <sys/prctl.h> | |||||
#endif | |||||
// -------------------------------------------------------------------------------------------------------------------- | // -------------------------------------------------------------------------------------------------------------------- | ||||
// process functions | // process functions | ||||
/* | /* | ||||
* Set current process name. | * 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. | * 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 | // process utility classes | ||||