Closes #5050: Add Mixer threading comments (#5069)

[ci skip]
This commit is contained in:
Johannes Lorenz
2019-07-11 18:22:41 +02:00
committed by GitHub
parent d766b87688
commit 59e186d208
2 changed files with 5 additions and 0 deletions

View File

@@ -315,6 +315,7 @@ public:
inline bool isMetronomeActive() const { return m_metronomeActive; }
inline void setMetronomeActive(bool value = true) { m_metronomeActive = value; }
//! Block until a change in model can be done (i.e. wait for audio thread)
void requestChangeInModel();
void doneChangeInModel();
@@ -366,6 +367,8 @@ private:
void clearInternal();
//! Called by the audio thread to give control to other threads,
//! such that they can do changes in the model (like e.g. removing effects)
void runChangesInModel();
bool m_renderOnly;

View File

@@ -831,7 +831,9 @@ void Mixer::runChangesInModel()
if( m_changesSignal )
{
m_waitChangesMutex.lock();
// allow changes in the model from other threads ...
m_changesRequestCondition.wakeOne();
// ... and wait until they are done
m_changesMixerCondition.wait( &m_waitChangesMutex );
m_waitChangesMutex.unlock();
}