Should fix #521 - no more "can not wait for thread termination" / "couldn't terminate thread" errors.

Originally committed to SVN as r1491.
This commit is contained in:
Niels Martin Hansen 2007-08-15 19:40:41 +00:00
parent 4ddc7d5820
commit aff3548407
1 changed files with 4 additions and 2 deletions

View File

@ -362,8 +362,10 @@ void DirectSoundPlayer::Play(__int64 start,__int64 count) {
void DirectSoundPlayer::Stop(bool timerToo) {
// Stop the thread
if (thread) {
thread->Stop();
thread->Wait();
if (thread->IsAlive()) {
thread->Stop();
thread->Wait();
}
thread = NULL;
}
// The thread is now guaranteed dead and there are no concurrency problems to worry about