This commit is contained in:
Glenn Maynard
2004-04-15 23:41:03 +00:00
parent a739e45e3f
commit 28449f1ca2
+7 -1
View File
@@ -161,7 +161,9 @@ void RageSoundManager::CommitPlayingPosition( int ID, int64_t frameno, int pos,
RageSound *RageSoundManager::GetSoundByID( int ID )
{
LockMut(g_SoundManMutex); /* lock for access to all_sounds */
/* You must lock this mutex before calling this function. If you don't,
* from any thread, the returned sound may be invalidated. */
ASSERT( g_SoundManMutex.IsLockedByThisThread() );
/* Find the sound with p.ID. */
set<RageSound *>::iterator it;
@@ -174,6 +176,10 @@ RageSound *RageSoundManager::GetSoundByID( int ID )
/* This is only called by RageSoundManager::Update. */
void RageSoundManager::FlushPosMapQueue()
{
/* Lock, to make sure sounds returned by GetSoundByID remain valid until we're
* done with them. */
LockMut(g_SoundManMutex);
queued_pos_map_t p;
/* We don't need to lock to access pos_map_queue. */