mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-26 03:30:46 +00:00
Slightly revise multivoc locking logic
git-svn-id: https://svn.eduke32.com/eduke32@7306 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
97c2271b92
commit
9f3cf8002b
1 changed files with 8 additions and 7 deletions
|
@ -98,14 +98,16 @@ static int32_t lockdepth = 0;
|
||||||
|
|
||||||
static FORCE_INLINE void DisableInterrupts(void)
|
static FORCE_INLINE void DisableInterrupts(void)
|
||||||
{
|
{
|
||||||
if (lockdepth++ <= 0)
|
if (!lockdepth++)
|
||||||
SoundDriver_Lock();
|
SoundDriver_Lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
static FORCE_INLINE void RestoreInterrupts(void)
|
static FORCE_INLINE void RestoreInterrupts(void)
|
||||||
{
|
{
|
||||||
if (--lockdepth <= 0)
|
if (!--lockdepth)
|
||||||
SoundDriver_Unlock();
|
SoundDriver_Unlock();
|
||||||
|
else if (lockdepth < 0 && MV_Printf)
|
||||||
|
MV_Printf("RestoreInterrupts(): lockdepth < 0!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *MV_ErrorString(int32_t ErrorNumber)
|
const char *MV_ErrorString(int32_t ErrorNumber)
|
||||||
|
@ -376,17 +378,16 @@ VoiceNode *MV_BeginService(int32_t handle)
|
||||||
if (!MV_Installed)
|
if (!MV_Installed)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
DisableInterrupts();
|
VoiceNode *voice = MV_GetVoice(handle);
|
||||||
|
|
||||||
VoiceNode *voice;
|
if (voice == NULL)
|
||||||
|
|
||||||
if ((voice = MV_GetVoice(handle)) == NULL)
|
|
||||||
{
|
{
|
||||||
RestoreInterrupts();
|
|
||||||
MV_SetErrorCode(MV_VoiceNotFound);
|
MV_SetErrorCode(MV_VoiceNotFound);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DisableInterrupts();
|
||||||
|
|
||||||
return voice;
|
return voice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue