diff --git a/ChangeLog b/ChangeLog index 6b3be70a6..31115aa86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-05-29 Tobias Doerffel + + * src/core/mixer.cpp: + use QAtomicInt instead of volatile bool + queue-global mutex for + worker-thread jobqueues + 2008-05-28 Tobias Doerffel * plugins/organic/organic.cpp: diff --git a/src/core/mixer.cpp b/src/core/mixer.cpp index 6fd6886f5..2d9bb5a19 100644 --- a/src/core/mixer.cpp +++ b/src/core/mixer.cpp @@ -135,15 +135,21 @@ public: int effectChannelJob; void * job; }; - + +#if QT_VERSION >= 0x040400 + QAtomicInt done; +#else volatile bool done; +#endif } ; typedef QVector jobQueueItems; struct jobQueue { jobQueueItems items; +#if QT_VERSION < 0x040400 QMutex lock; +#endif } ; mixerWorkerThread( mixer * _mixer ) : @@ -186,11 +192,16 @@ private: m_jobQueue->items.begin(); it != m_jobQueue->items.end(); ++it ) { +#if QT_VERSION >= 0x040400 + if( it->done.fetchAndStoreRelaxed( 1 ) == 0 ) + { +#else m_jobQueue->lock.lock(); if( !it->done ) { it->done = TRUE; m_jobQueue->lock.unlock(); +#endif switch( it->type ) { case PlayHandle: @@ -215,10 +226,12 @@ private: break; } } +#if QT_VERSION < 0x040400 else { m_jobQueue->lock.unlock(); } +#endif } m_sem->release(); }