Browse Source

Fix CarlaThread not able to start if RT is not allowed

Fixes usage with stock Fedora

Signed-off-by: falkTX <falktx@gmail.com>
tags/v2.1-alpha2
falkTX 6 years ago
parent
commit
1272c3d056
Signed by: falkTX <falktx@gmail.com> GPG Key ID: 2D3445A829213837
1 changed files with 11 additions and 3 deletions
  1. +11
    -3
      source/utils/CarlaThread.hpp

+ 11
- 3
source/utils/CarlaThread.hpp View File

@@ -112,12 +112,12 @@ public:
# endif
pthread_attr_setschedparam(&attr, &sched_param) == 0)
{
carla_stdout("CarlaThread with realtime priority successful");
carla_stdout("CarlaThread setup with realtime priority successful");
}
else
#endif
{
carla_stdout("CarlaThread with realtime priority failed, going with normal priority instead");
carla_stdout("CarlaThread setup with realtime priority failed, going with normal priority instead");
pthread_attr_destroy(&attr);
pthread_attr_init(&attr);
}
@@ -127,9 +127,17 @@ public:

fShouldExit = false;

const bool ok = pthread_create(&handle, &attr, _entryPoint, this) == 0;
bool ok = pthread_create(&handle, &attr, _entryPoint, this) == 0;
pthread_attr_destroy(&attr);

if (withRealtimePriority && !ok)
{
carla_stdout("CarlaThread with realtime priority failed on creation, going with normal priority instead");
pthread_attr_init(&attr);
ok = pthread_create(&handle, &attr, _entryPoint, this) == 0;
pthread_attr_destroy(&attr);
}

CARLA_SAFE_ASSERT_RETURN(ok, false);
#ifdef PTW32_DLLPORT
CARLA_SAFE_ASSERT_RETURN(handle.p != nullptr, false);


Loading…
Cancel
Save