Update of /cvsroot/audacity/audacity-src/src/ondemand In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv19613/ondemand
Modified Files: ODManager.cpp Log Message: second attempt to fix hanging on win. works on mac but linux should be retested too. Index: ODManager.cpp =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/ondemand/ODManager.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- ODManager.cpp 6 Oct 2009 23:12:21 -0000 1.31 +++ ODManager.cpp 7 Oct 2009 15:50:35 -0000 1.32 @@ -128,9 +128,9 @@ //must set up the queue condition mQueueNotEmptyCond = new ODCondition(&mQueueNotEmptyCondLock); -#ifndef __WX_MAC__ - mQueueNotEmptyCondLock.Lock(); -#endif +//#ifndef __WX_MAC__ +// mQueueNotEmptyCondLock.Lock(); +//#endif } //private constructor - delete with static method Quit() @@ -153,14 +153,24 @@ mTasks.push_back(task); mTasksMutex.Unlock(); //signal the queue not empty condition. -#ifdef __WX_MAC__ +//#ifdef __WX_MAC__ + + bool paused; + + mPauseLock.Lock(); + paused=mPause; + mPauseLock.Unlock(); + mQueueNotEmptyCondLock.Lock(); -#endif - mQueueNotEmptyCond->Signal(); +//#endif + //don't signal if we are paused. + + if(!paused) + mQueueNotEmptyCond->Signal(); -#ifdef __WX_MAC__ +//#ifdef __WX_MAC__ mQueueNotEmptyCondLock.Unlock(); -#endif +//#endif } ///removes a task from the active task queue @@ -338,19 +348,20 @@ //wxThread::Sleep(200); //the behavior for wait is different in pthreads(mac) and wx (win/linux). //wait in wx locks -#ifdef __WX_MAC__ +//#ifdef __WX_MAC__ mQueueNotEmptyCondLock.Lock(); -#endif +//#endif if(tasksInArray<=0 || paused) mQueueNotEmptyCond->Wait(); -#ifdef __WX_MAC__ +//#ifdef __WX_MAC__ mQueueNotEmptyCondLock.Unlock(); -#endif +//#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; mQueuesMutex.Unlock(); +//TODO:check with last draw time and only redraw if more than half a second has passed. //redraw the current project only (ODTasks will send a redraw on complete even if the projects are in the background) if(mNeedsDraw ) { @@ -384,7 +395,13 @@ ODManager::Instance()->mPauseLock.Unlock(); //we should check the queue again. +//#ifdef __WX_MAC__ + ODManager::Instance()->mQueueNotEmptyCondLock.Lock(); +//#endif ODManager::Instance()->mQueueNotEmptyCond->Signal(); +//#ifdef __WX_MAC__ + ODManager::Instance()->mQueueNotEmptyCondLock.Unlock(); +//#endif } else { @@ -413,14 +430,14 @@ //signal the queue not empty condition since the ODMan thread will wait on the queue condition -#ifdef __WX_MAC__ +//#ifdef __WX_MAC__ ODManager::Instance()->mQueueNotEmptyCondLock.Lock(); -#endif +//#endif ODManager::Instance()->mQueueNotEmptyCond->Signal(); -#ifdef __WX_MAC__ +//#ifdef __WX_MAC__ ODManager::Instance()->mQueueNotEmptyCondLock.Unlock(); -#endif +//#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