Update of /cvsroot/audacity/audacity-src/src/ondemand
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv27326/ondemand

Modified Files:
        ODManager.cpp 
Log Message:
fixing multiple file crash for OD.


Index: ODManager.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/ondemand/ODManager.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- ODManager.cpp       6 Oct 2009 15:56:41 -0000       1.30
+++ ODManager.cpp       6 Oct 2009 23:12:21 -0000       1.31
@@ -128,7 +128,9 @@
    
    //must set up the queue condition
    mQueueNotEmptyCond = new ODCondition(&mQueueNotEmptyCondLock);
-   
+#ifndef __WX_MAC__
+   mQueueNotEmptyCondLock.Lock();
+#endif   
 }
 
 //private constructor - delete with static method Quit()
@@ -151,9 +153,14 @@
    mTasks.push_back(task);
    mTasksMutex.Unlock();
    //signal the queue not empty condition.
+#ifdef __WX_MAC__
    mQueueNotEmptyCondLock.Lock();
+#endif
    mQueueNotEmptyCond->Signal();
+
+#ifdef __WX_MAC__   
    mQueueNotEmptyCondLock.Unlock();
+#endif
 }
 
 ///removes a task from the active task queue
@@ -329,11 +336,16 @@
       mCurrentThreadsMutex.Unlock();
       //use a conditon variable to block here instead of a sleep.  
       //wxThread::Sleep(200);
+      //the behavior for wait is different in pthreads(mac) and wx (win/linux).
+      //wait in wx locks 
+#ifdef __WX_MAC__
       mQueueNotEmptyCondLock.Lock();
-      if(tasksInArray<=0)
+#endif
+      if(tasksInArray<=0 || paused)
          mQueueNotEmptyCond->Wait();
+#ifdef __WX_MAC__
       mQueueNotEmptyCondLock.Unlock();
-      
+#endif      
       //if there is some ODTask running, then there will be something in the 
queue.  If so then redraw to show progress      
       mQueuesMutex.Lock();
       mNeedsDraw += mQueues.size()>0?1:0;
@@ -370,6 +382,9 @@
       ODManager::Instance()->mPauseLock.Lock();
       ODManager::Instance()->mPause = pause;
       ODManager::Instance()->mPauseLock.Unlock();
+      
+      //we should check the queue again.
+      ODManager::Instance()->mQueueNotEmptyCond->Signal();
    }
    else
    {
@@ -397,9 +412,15 @@
          wxThread::Sleep(200);
          
          //signal the queue not empty condition since the ODMan thread will 
wait on the queue condition
+
+#ifdef __WX_MAC__
          ODManager::Instance()->mQueueNotEmptyCondLock.Lock();
+#endif
          ODManager::Instance()->mQueueNotEmptyCond->Signal();
+         
+#ifdef __WX_MAC__
          ODManager::Instance()->mQueueNotEmptyCondLock.Unlock();
+#endif         
          ODManager::Instance()->mTerminatedMutex.Lock();
       }
       ODManager::Instance()->mTerminatedMutex.Unlock();


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Audacity-cvs mailing list
Audacity-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to