Browse Source

Set Carla as process name when really appropriate, closes #138

tags/1.9.5
falkTX 10 years ago
parent
commit
1698dbb8a5
2 changed files with 10 additions and 8 deletions
  1. +6
    -3
      source/backend/CarlaStandalone.cpp
  2. +4
    -5
      source/utils/CarlaThread.hpp

+ 6
- 3
source/backend/CarlaStandalone.cpp View File

@@ -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;



+ 4
- 5
source/utils/CarlaThread.hpp View File

@@ -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 <sys/prctl.h>
#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
}



Loading…
Cancel
Save