mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-05 15:09:08 +02:00
Eliminate a race condition.
This commit is contained in:
parent
77b874c5d9
commit
8bc7f68edc
@ -1762,6 +1762,8 @@ AudioThread::ExitCode AudioThread::Entry()
|
|||||||
{
|
{
|
||||||
while( !TestDestroy() )
|
while( !TestDestroy() )
|
||||||
{
|
{
|
||||||
|
// Set LoopActive outside the tests to avoid race condition
|
||||||
|
gAudioIO->mAudioThreadFillBuffersLoopActive = true;
|
||||||
if( gAudioIO->mAudioThreadShouldCallFillBuffersOnce )
|
if( gAudioIO->mAudioThreadShouldCallFillBuffersOnce )
|
||||||
{
|
{
|
||||||
gAudioIO->FillBuffers();
|
gAudioIO->FillBuffers();
|
||||||
@ -1771,6 +1773,7 @@ AudioThread::ExitCode AudioThread::Entry()
|
|||||||
{
|
{
|
||||||
gAudioIO->FillBuffers();
|
gAudioIO->FillBuffers();
|
||||||
}
|
}
|
||||||
|
gAudioIO->mAudioThreadFillBuffersLoopActive = false;
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||||
if( gAudioIO->mMidiStreamActive &&
|
if( gAudioIO->mMidiStreamActive &&
|
||||||
@ -2123,8 +2126,6 @@ void AudioIO::FillBuffers()
|
|||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
gAudioIO->mAudioThreadFillBuffersLoopActive = true;
|
|
||||||
|
|
||||||
if( mPlaybackTracks.GetCount() > 0 )
|
if( mPlaybackTracks.GetCount() > 0 )
|
||||||
{
|
{
|
||||||
// Though extremely unlikely, it is possible that some buffers
|
// Though extremely unlikely, it is possible that some buffers
|
||||||
@ -2285,7 +2286,6 @@ void AudioIO::FillBuffers()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gAudioIO->mAudioThreadFillBuffersLoopActive = false;
|
|
||||||
//if ( mMidiStreamActive && mMidiPlaybackTracks.GetCount() > 0 )
|
//if ( mMidiStreamActive && mMidiPlaybackTracks.GetCount() > 0 )
|
||||||
//FillMidiBuffers();
|
//FillMidiBuffers();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user