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

View file

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