23 |
#include "../common/global_private.h" |
#include "../common/global_private.h" |
24 |
#include "EngineChannelFactory.h" |
#include "EngineChannelFactory.h" |
25 |
|
|
26 |
|
#ifdef __APPLE__ |
27 |
|
#include <sys/utsname.h> |
28 |
|
#endif |
29 |
|
|
30 |
namespace LinuxSampler { |
namespace LinuxSampler { |
31 |
|
|
32 |
InstrumentManagerThread::InstrumentManagerThread() : Thread(true, false, 0, -4) { |
InstrumentManagerThread::InstrumentManagerThread() : Thread(true, false, 0, -4) { |
180 |
|
|
181 |
#ifdef __APPLE__ |
#ifdef __APPLE__ |
182 |
int InstrumentManagerThread::StopThread() { |
int InstrumentManagerThread::StopThread() { |
183 |
// This is a fix for Mac OS X, where SignalStopThread doesn't |
utsname buf; |
184 |
// wake up a thread waiting for a condition variable. |
int osVersion = uname(&buf) ? 0 : atoi(buf.release); |
185 |
SignalStopThread(); // send stop signal, but don't wait |
|
186 |
conditionJobsLeft.Set(true); // wake thread |
// This is a fix for Mac OS X 10.6 and earlier, where |
187 |
|
// SignalStopThread doesn't wake up a thread waiting for a |
188 |
|
// condition variable. |
189 |
|
if (osVersion < 11) { // darwin 11 = OS X 10.7 |
190 |
|
SignalStopThread(); // send stop signal, but don't wait |
191 |
|
conditionJobsLeft.Set(true); // wake thread |
192 |
|
} |
193 |
return Thread::StopThread(); // then wait for it to cancel |
return Thread::StopThread(); // then wait for it to cancel |
194 |
} |
} |
195 |
#endif |
#endif |