fix race
This commit is contained in:
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user