From d6efbc455c2cd0ad6421ccc16c0835ffd2e8ab3e Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 18 Jan 2007 07:32:41 +0000 Subject: [PATCH] This isn't safe; RageSoundDriver::StopMixing skips to HALTING. The decoder thread shouldn't hold the lock long anymore, since reading data should be nonblocking (readers at this point are either preloaded, or have a threaded buffer). --- .../src/arch/Sound/RageSoundDriver_Generic_Software.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/stepmania/src/arch/Sound/RageSoundDriver_Generic_Software.cpp b/stepmania/src/arch/Sound/RageSoundDriver_Generic_Software.cpp index cb66c13299..2d4a4dd16d 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_Generic_Software.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_Generic_Software.cpp @@ -247,13 +247,10 @@ int RageSoundDriver::GetDataForSound( Sound &s ) void RageSoundDriver::Update() { - /* We must not lock here, since the decoder thread might hold the lock for a - * while at a time. This is threadsafe, because once a sound is in STOPPING, - * this is the only place it'll be changed (to STOPPED). */ + m_Mutex.Lock(); for( unsigned i = 0; i < ARRAYLEN(m_Sounds); ++i ) { { - /* We don't need to lock to access m_PosMapQueue. */ Sound::QueuedPosMap p; while( m_Sounds[i].m_PosMapQueue.read( &p, 1 ) ) { @@ -306,6 +303,8 @@ void RageSoundDriver::Update() fNext = RageTimer::GetTimeSinceStart() + 1; } } + + m_Mutex.Unlock(); } void RageSoundDriver::StartMixing( RageSoundBase *pSound )