aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alSource.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-08-03 00:56:58 -0700
committerChris Robinson <[email protected]>2014-08-03 00:56:58 -0700
commit451b780e081bdf574392786df6a5ca712128b891 (patch)
treefe80bfbd636fc0cd2e6fca1b94a37b2a47f249da /OpenAL32/alSource.c
parentf5194a9d8e9ce58b0c1a082686ccf180ea66f8ad (diff)
Fix some lock ordering to avoid potential deadlocks
Diffstat (limited to 'OpenAL32/alSource.c')
-rw-r--r--OpenAL32/alSource.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 155a7f8b..752e2e35 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -935,11 +935,11 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SrcFloatProp
case AL_SEC_OFFSET:
case AL_SAMPLE_OFFSET:
case AL_BYTE_OFFSET:
- ReadLock(&Source->queue_lock);
LockContext(Context);
+ ReadLock(&Source->queue_lock);
GetSourceOffsets(Source, prop, offsets, 0.0);
- UnlockContext(Context);
ReadUnlock(&Source->queue_lock);
+ UnlockContext(Context);
*values = offsets[0];
return AL_TRUE;
@@ -982,23 +982,23 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SrcFloatProp
case AL_SAMPLE_RW_OFFSETS_SOFT:
case AL_BYTE_RW_OFFSETS_SOFT:
- ReadLock(&Source->queue_lock);
LockContext(Context);
+ ReadLock(&Source->queue_lock);
updateLen = (ALdouble)Context->Device->UpdateSize /
Context->Device->Frequency;
GetSourceOffsets(Source, prop, values, updateLen);
- UnlockContext(Context);
ReadUnlock(&Source->queue_lock);
+ UnlockContext(Context);
return AL_TRUE;
case AL_SEC_OFFSET_LATENCY_SOFT:
- ReadLock(&Source->queue_lock);
LockContext(Context);
+ ReadLock(&Source->queue_lock);
values[0] = GetSourceSecOffset(Source);
+ ReadUnlock(&Source->queue_lock);
values[1] = (ALdouble)ALCdevice_GetLatency(Context->Device) /
1000000000.0;
UnlockContext(Context);
- ReadUnlock(&Source->queue_lock);
return AL_TRUE;
case AL_POSITION:
@@ -1247,12 +1247,12 @@ static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SrcIntProp
switch(prop)
{
case AL_SAMPLE_OFFSET_LATENCY_SOFT:
- ReadLock(&Source->queue_lock);
LockContext(Context);
+ ReadLock(&Source->queue_lock);
values[0] = GetSourceOffset(Source);
+ ReadUnlock(&Source->queue_lock);
values[1] = ALCdevice_GetLatency(Context->Device);
UnlockContext(Context);
- ReadUnlock(&Source->queue_lock);
return AL_TRUE;
case AL_MAX_DISTANCE: