/[svn]/linuxsampler/trunk/src/engines/InstrumentManagerThread.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/InstrumentManagerThread.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2324 by persson, Sun Mar 4 09:01:32 2012 UTC revision 2349 by persson, Sun Jun 17 15:47:43 2012 UTC
# Line 23  Line 23 
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) {
# Line 110  namespace LinuxSampler { Line 114  namespace LinuxSampler {
114                  if (!empty) {                  if (!empty) {
115                      cmd = queue.front();                      cmd = queue.front();
116                      queue.pop_front();                      queue.pop_front();
117    
118                        if (cmd.type == command_t::DIRECT_LOAD) {
119                            EngineChannelFactory::SetDeleteEnabled(cmd.pEngineChannel, false);
120                        }
121                  }                  }
122                  mutex.Unlock();                  mutex.Unlock();
123                  if (empty) break;                  if (empty) break;
# Line 117  namespace LinuxSampler { Line 125  namespace LinuxSampler {
125                  try {                  try {
126                      switch (cmd.type) {                      switch (cmd.type) {
127                          case command_t::DIRECT_LOAD:                          case command_t::DIRECT_LOAD:
                             EngineChannelFactory::SetDeleteEnabled(cmd.pEngineChannel, false);  
128                              cmd.pEngineChannel->PrepareLoadInstrument(cmd.instrumentId.FileName.c_str(), cmd.instrumentId.Index);                              cmd.pEngineChannel->PrepareLoadInstrument(cmd.instrumentId.FileName.c_str(), cmd.instrumentId.Index);
129                              cmd.pEngineChannel->LoadInstrument();                              cmd.pEngineChannel->LoadInstrument();
130                              EngineChannelFactory::SetDeleteEnabled(cmd.pEngineChannel, true);                              EngineChannelFactory::SetDeleteEnabled(cmd.pEngineChannel, true);
# Line 173  namespace LinuxSampler { Line 180  namespace LinuxSampler {
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

Legend:
Removed from v.2324  
changed lines
  Added in v.2349

  ViewVC Help
Powered by ViewVC