23 |
#include "../common/global_private.h" |
#include "../common/global_private.h" |
24 |
#include "EngineChannelFactory.h" |
#include "EngineChannelFactory.h" |
25 |
|
|
|
#ifdef __APPLE__ |
|
|
#include <sys/utsname.h> |
|
|
#endif |
|
|
|
|
26 |
namespace LinuxSampler { |
namespace LinuxSampler { |
27 |
|
|
28 |
InstrumentManagerThread::InstrumentManagerThread() : Thread(true, false, 0, -4) { |
InstrumentManagerThread::InstrumentManagerThread() : Thread(true, false, 0, -4) { |
174 |
pThread->mutex.Unlock(); |
pThread->mutex.Unlock(); |
175 |
} |
} |
176 |
|
|
177 |
#ifdef __APPLE__ |
#if defined(__APPLE__) && !defined(__x86_64__) |
178 |
int InstrumentManagerThread::StopThread() { |
int InstrumentManagerThread::StopThread() { |
179 |
utsname buf; |
// This is a fix for Mac OS X 32 bit, where SignalStopThread |
180 |
int osVersion = uname(&buf) ? 0 : atoi(buf.release); |
// doesn't wake up a thread waiting for a condition variable. |
181 |
|
SignalStopThread(); // send stop signal, but don't wait |
182 |
// This is a fix for Mac OS X 10.6 and earlier, where |
conditionJobsLeft.Set(true); // wake thread |
|
// SignalStopThread doesn't wake up a thread waiting for a |
|
|
// condition variable. |
|
|
if (osVersion < 11) { // darwin 11 = OS X 10.7 |
|
|
SignalStopThread(); // send stop signal, but don't wait |
|
|
conditionJobsLeft.Set(true); // wake thread |
|
|
} |
|
183 |
return Thread::StopThread(); // then wait for it to cancel |
return Thread::StopThread(); // then wait for it to cancel |
184 |
} |
} |
185 |
#endif |
#endif |