diff --git a/source/backend/CarlaStandalone.cpp b/source/backend/CarlaStandalone.cpp index 98e4c2508..00d686dd5 100644 --- a/source/backend/CarlaStandalone.cpp +++ b/source/backend/CarlaStandalone.cpp @@ -27,6 +27,7 @@ #include "CarlaBackendUtils.hpp" #include "CarlaBase64Utils.hpp" #include "CarlaOscUtils.hpp" +#include "CarlaThread.hpp" #include "juce_audio_formats.h" @@ -75,9 +76,6 @@ struct CarlaBackendStandalone { File binaryDir(File::getSpecialLocation(File::currentExecutableFile).getParentDirectory()); engineOptions.binaryDir = carla_strdup_safe(binaryDir.getFullPathName().toRawUTF8()); engineOptions.resourceDir = carla_strdup_safe(binaryDir.getChildFile("resources").getFullPathName().toRawUTF8()); -#else - if (std::getenv("LADISH_APP_NAME") == nullptr && std::getenv("NSM_URL") == nullptr) - juce::Thread::setCurrentThreadName("Carla"); #endif } @@ -773,6 +771,11 @@ void carla_set_engine_option(EngineOption option, int value, const char* valueSt case CB:: ENGINE_OPTION_NSM_INIT: CARLA_SAFE_ASSERT_RETURN(value != 0,); CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); + + // this is only called if we're not a plugin, so it's safe + CarlaThread::setCurrentThreadName("Carla"); + juce::Thread::setCurrentThreadName("Carla"); + gNSM.announce(value, valueStr); break; diff --git a/source/utils/CarlaThread.hpp b/source/utils/CarlaThread.hpp index aba8e3208..8c90893cc 100644 --- a/source/utils/CarlaThread.hpp +++ b/source/utils/CarlaThread.hpp @@ -21,9 +21,7 @@ #include "CarlaMutex.hpp" #include "CarlaString.hpp" -#if defined(__GLIBC__) && (__GLIBC__ * 1000 + __GLIBC_MINOR__) >= 2012 -// has pthread_setname_np -#elif defined(CARLA_OS_LINUX) +#ifdef CARLA_OS_LINUX # include #endif @@ -198,10 +196,11 @@ public: { CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0',); +#ifdef CARLA_OS_LINUX + prctl(PR_SET_NAME, name, 0, 0, 0); +#endif #if defined(__GLIBC__) && (__GLIBC__ * 1000 + __GLIBC_MINOR__) >= 2012 pthread_setname_np(pthread_self(), name); -#elif defined(CARLA_OS_LINUX) - prctl(PR_SET_NAME, name, 0, 0, 0); #endif }