Do not busy wait when writing buffer in mixer

This commit is contained in:
Javier Serrano Polo
2016-07-02 21:57:55 +02:00
parent 46c2aa32ea
commit 8497d39eec
3 changed files with 17 additions and 29 deletions

View File

@@ -409,7 +409,6 @@ private:
bool m_clearSignal;
bool m_changesSignal;
bool m_waitForMixer;
unsigned int m_changes;
QMutex m_changesMutex;
QMutex m_doChangesMutex;
@@ -417,6 +416,8 @@ private:
QWaitCondition m_changesMixerCondition;
QWaitCondition m_changesRequestCondition;
bool m_waitingForWrite;
friend class LmmsCore;
friend class MixerWorkerThread;

View File

@@ -57,18 +57,6 @@ public:
m_reader_sem.release();
}
bool tryWrite( T _element )
{
if( m_writer_sem.tryAcquire() )
{
m_buffer[m_writer_index++] = _element;
m_writer_index %= m_size;
m_reader_sem.release();
return true;
}
return false;
}
T read()
{
m_reader_sem.acquire();