aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-03-03 13:42:37 -0800
committerChris Robinson <[email protected]>2018-03-03 13:42:37 -0800
commit4e6c758daf1849741712eaf451f392264fd49244 (patch)
tree7db357344dac8cf7f90005ad5a5378443adf192c
parent4bd02eada65a9c9140c0c62524692038165e9a31 (diff)
Use a plain mutex for the property lock
-rw-r--r--Alc/ALc.c12
-rw-r--r--OpenAL32/Include/alMain.h3
-rw-r--r--OpenAL32/alAuxEffectSlot.c8
-rw-r--r--OpenAL32/alListener.c48
-rw-r--r--OpenAL32/alSource.c72
-rw-r--r--OpenAL32/alState.c24
6 files changed, 72 insertions, 95 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 3fd3ab8f..ab21c356 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1629,7 +1629,7 @@ void ALCcontext_DeferUpdates(ALCcontext *context)
*/
void ALCcontext_ProcessUpdates(ALCcontext *context)
{
- ReadLock(&context->PropLock);
+ almtx_lock(&context->PropLock);
if(ATOMIC_EXCHANGE_SEQ(&context->DeferUpdates, AL_FALSE))
{
/* Tell the mixer to stop applying updates, then wait for any active
@@ -1651,7 +1651,7 @@ void ALCcontext_ProcessUpdates(ALCcontext *context)
*/
ATOMIC_STORE_SEQ(&context->HoldUpdates, AL_FALSE);
}
- ReadUnlock(&context->PropLock);
+ almtx_unlock(&context->PropLock);
}
@@ -2244,7 +2244,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
UpdateEffectSlotProps(slot, context);
}
- WriteLock(&context->PropLock);
+ almtx_lock(&context->PropLock);
almtx_lock(&context->EffectSlotLock);
for(pos = 0;pos < (ALsizei)VECTOR_SIZE(context->EffectSlotList);pos++)
{
@@ -2342,7 +2342,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
ATOMIC_FLAG_TEST_AND_SET(&context->Listener->PropsClean, almemory_order_release);
UpdateListenerProps(context);
UpdateAllSourceProps(context);
- WriteUnlock(&context->PropLock);
+ almtx_unlock(&context->PropLock);
context = ATOMIC_LOAD(&context->next, almemory_order_relaxed);
}
@@ -2581,7 +2581,7 @@ static ALvoid InitContext(ALCcontext *Context)
InitRef(&Context->UpdateCount, 0);
ATOMIC_INIT(&Context->HoldUpdates, AL_FALSE);
Context->GainBoost = 1.0f;
- RWLockInit(&Context->PropLock);
+ almtx_init(&Context->PropLock, almtx_plain);
ATOMIC_INIT(&Context->LastError, AL_NO_ERROR);
VECTOR_INIT(Context->SourceList);
Context->NumSources = 0;
@@ -2763,6 +2763,8 @@ static void FreeContext(ALCcontext *context)
ll_ringbuffer_free(context->AsyncEvents);
context->AsyncEvents = NULL;
+ almtx_destroy(&context->PropLock);
+
ALCdevice_DecRef(context->Device);
context->Device = NULL;
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index b21b76a3..6d6d661f 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -26,7 +26,6 @@
#include "static_assert.h"
#include "align.h"
#include "atomic.h"
-#include "uintmap.h"
#include "vector.h"
#include "alstring.h"
#include "almalloc.h"
@@ -651,7 +650,7 @@ struct ALCcontext_struct {
ATOMIC_FLAG PropsClean;
ATOMIC(ALenum) DeferUpdates;
- RWLock PropLock;
+ almtx_t PropLock;
/* Counter for the pre-mixing updates, in 31.1 fixed point (lowest bit
* indicates if updates are currently happening).
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index 04edcc09..6eb6187b 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -244,7 +244,7 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param
context = GetContextRef();
if(!context) return;
- WriteLock(&context->PropLock);
+ almtx_lock(&context->PropLock);
LockEffectSlotList(context);
if((slot=LookupEffectSlot(context, effectslot)) == NULL)
SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot);
@@ -282,7 +282,7 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param
done:
UnlockEffectSlotList(context);
- WriteUnlock(&context->PropLock);
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
}
@@ -324,7 +324,7 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param
context = GetContextRef();
if(!context) return;
- WriteLock(&context->PropLock);
+ almtx_lock(&context->PropLock);
LockEffectSlotList(context);
if((slot=LookupEffectSlot(context, effectslot)) == NULL)
SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot);
@@ -344,7 +344,7 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param
done:
UnlockEffectSlotList(context);
- WriteUnlock(&context->PropLock);
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
}
diff --git a/OpenAL32/alListener.c b/OpenAL32/alListener.c
index 290ae8ca..f1ac3ff4 100644
--- a/OpenAL32/alListener.c
+++ b/OpenAL32/alListener.c
@@ -43,7 +43,7 @@ AL_API ALvoid AL_APIENTRY alListenerf(ALenum param, ALfloat value)
if(!context) return;
listener = context->Listener;
- WriteLock(&context->PropLock);
+ almtx_lock(&context->PropLock);
switch(param)
{
case AL_GAIN:
@@ -68,7 +68,7 @@ AL_API ALvoid AL_APIENTRY alListenerf(ALenum param, ALfloat value)
}
done:
- WriteUnlock(&context->PropLock);
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
}
@@ -82,7 +82,7 @@ AL_API ALvoid AL_APIENTRY alListener3f(ALenum param, ALfloat value1, ALfloat val
if(!context) return;
listener = context->Listener;
- WriteLock(&context->PropLock);
+ almtx_lock(&context->PropLock);
switch(param)
{
case AL_POSITION:
@@ -108,7 +108,7 @@ AL_API ALvoid AL_APIENTRY alListener3f(ALenum param, ALfloat value1, ALfloat val
}
done:
- WriteUnlock(&context->PropLock);
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
}
@@ -138,7 +138,7 @@ AL_API ALvoid AL_APIENTRY alListenerfv(ALenum param, const ALfloat *values)
if(!context) return;
listener = context->Listener;
- WriteLock(&context->PropLock);
+ almtx_lock(&context->PropLock);
if(!values) SETERR_GOTO(context, AL_INVALID_VALUE, done, "NULL pointer");
switch(param)
{
@@ -161,7 +161,7 @@ AL_API ALvoid AL_APIENTRY alListenerfv(ALenum param, const ALfloat *values)
}
done:
- WriteUnlock(&context->PropLock);
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
}
@@ -173,13 +173,13 @@ AL_API ALvoid AL_APIENTRY alListeneri(ALenum param, ALint UNUSED(value))
context = GetContextRef();
if(!context) return;
- WriteLock(&context->PropLock);
+ almtx_lock(&context->PropLock);
switch(param)
{
default:
alSetError(context, AL_INVALID_ENUM, "Invalid listener integer property");
}
- WriteUnlock(&context->PropLock);
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
}
@@ -200,13 +200,13 @@ AL_API void AL_APIENTRY alListener3i(ALenum param, ALint value1, ALint value2, A
context = GetContextRef();
if(!context) return;
- WriteLock(&context->PropLock);
+ almtx_lock(&context->PropLock);
switch(param)
{
default:
alSetError(context, AL_INVALID_ENUM, "Invalid listener 3-integer property");
}
- WriteUnlock(&context->PropLock);
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
}
@@ -241,7 +241,7 @@ AL_API void AL_APIENTRY alListeneriv(ALenum param, const ALint *values)
context = GetContextRef();
if(!context) return;
- WriteLock(&context->PropLock);
+ almtx_lock(&context->PropLock);
if(!values)
alSetError(context, AL_INVALID_VALUE, "NULL pointer");
else switch(param)
@@ -249,7 +249,7 @@ AL_API void AL_APIENTRY alListeneriv(ALenum param, const ALint *values)
default:
alSetError(context, AL_INVALID_ENUM, "Invalid listener integer-vector property");
}
- WriteUnlock(&context->PropLock);
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
}
@@ -262,7 +262,7 @@ AL_API ALvoid AL_APIENTRY alGetListenerf(ALenum param, ALfloat *value)
context = GetContextRef();
if(!context) return;
- ReadLock(&context->PropLock);
+ almtx_lock(&context->PropLock);
if(!value)
alSetError(context, AL_INVALID_VALUE, "NULL pointer");
else switch(param)
@@ -278,7 +278,7 @@ AL_API ALvoid AL_APIENTRY alGetListenerf(ALenum param, ALfloat *value)
default:
alSetError(context, AL_INVALID_ENUM, "Invalid listener float property");
}
- ReadUnlock(&context->PropLock);
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
}
@@ -291,7 +291,7 @@ AL_API ALvoid AL_APIENTRY alGetListener3f(ALenum param, ALfloat *value1, ALfloat
context = GetContextRef();
if(!context) return;
- ReadLock(&context->PropLock);
+ almtx_lock(&context->PropLock);
if(!value1 || !value2 || !value3)
alSetError(context, AL_INVALID_VALUE, "NULL pointer");
else switch(param)
@@ -311,7 +311,7 @@ AL_API ALvoid AL_APIENTRY alGetListener3f(ALenum param, ALfloat *value1, ALfloat
default:
alSetError(context, AL_INVALID_ENUM, "Invalid listener 3-float property");
}
- ReadUnlock(&context->PropLock);
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
}
@@ -337,7 +337,7 @@ AL_API ALvoid AL_APIENTRY alGetListenerfv(ALenum param, ALfloat *values)
context = GetContextRef();
if(!context) return;
- ReadLock(&context->PropLock);
+ almtx_lock(&context->PropLock);
if(!values)
alSetError(context, AL_INVALID_VALUE, "NULL pointer");
else switch(param)
@@ -355,7 +355,7 @@ AL_API ALvoid AL_APIENTRY alGetListenerfv(ALenum param, ALfloat *values)
default:
alSetError(context, AL_INVALID_ENUM, "Invalid listener float-vector property");
}
- ReadUnlock(&context->PropLock);
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
}
@@ -368,7 +368,7 @@ AL_API ALvoid AL_APIENTRY alGetListeneri(ALenum param, ALint *value)
context = GetContextRef();
if(!context) return;
- ReadLock(&context->PropLock);
+ almtx_lock(&context->PropLock);
if(!value)
alSetError(context, AL_INVALID_VALUE, "NULL pointer");
else switch(param)
@@ -376,7 +376,7 @@ AL_API ALvoid AL_APIENTRY alGetListeneri(ALenum param, ALint *value)
default:
alSetError(context, AL_INVALID_ENUM, "Invalid listener integer property");
}
- ReadUnlock(&context->PropLock);
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
}
@@ -389,7 +389,7 @@ AL_API void AL_APIENTRY alGetListener3i(ALenum param, ALint *value1, ALint *valu
context = GetContextRef();
if(!context) return;
- ReadLock(&context->PropLock);
+ almtx_lock(&context->PropLock);
if(!value1 || !value2 || !value3)
alSetError(context, AL_INVALID_VALUE, "NULL pointer");
else switch(param)
@@ -409,7 +409,7 @@ AL_API void AL_APIENTRY alGetListener3i(ALenum param, ALint *value1, ALint *valu
default:
alSetError(context, AL_INVALID_ENUM, "Invalid listener 3-integer property");
}
- ReadUnlock(&context->PropLock);
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
}
@@ -430,7 +430,7 @@ AL_API void AL_APIENTRY alGetListeneriv(ALenum param, ALint* values)
context = GetContextRef();
if(!context) return;
- ReadLock(&context->PropLock);
+ almtx_lock(&context->PropLock);
if(!values)
alSetError(context, AL_INVALID_VALUE, "NULL pointer");
else switch(param)
@@ -448,7 +448,7 @@ AL_API void AL_APIENTRY alGetListeneriv(ALenum param, ALint* values)
default:
alSetError(context, AL_INVALID_ENUM, "Invalid listener integer-vector property");
}
- ReadUnlock(&context->PropLock);
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
}
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index b3cf9e3e..02511382 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -1757,7 +1757,7 @@ AL_API ALvoid AL_APIENTRY alSourcef(ALuint source, ALenum param, ALfloat value)
Context = GetContextRef();
if(!Context) return;
- WriteLock(&Context->PropLock);
+ almtx_lock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -1766,7 +1766,7 @@ AL_API ALvoid AL_APIENTRY alSourcef(ALuint source, ALenum param, ALfloat value)
else
SetSourcefv(Source, Context, param, &value);
UnlockSourceList(Context);
- WriteUnlock(&Context->PropLock);
+ almtx_unlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -1779,7 +1779,7 @@ AL_API ALvoid AL_APIENTRY alSource3f(ALuint source, ALenum param, ALfloat value1
Context = GetContextRef();
if(!Context) return;
- WriteLock(&Context->PropLock);
+ almtx_lock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -1791,7 +1791,7 @@ AL_API ALvoid AL_APIENTRY alSource3f(ALuint source, ALenum param, ALfloat value1
SetSourcefv(Source, Context, param, fvals);
}
UnlockSourceList(Context);
- WriteUnlock(&Context->PropLock);
+ almtx_unlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -1804,7 +1804,7 @@ AL_API ALvoid AL_APIENTRY alSourcefv(ALuint source, ALenum param, const ALfloat
Context = GetContextRef();
if(!Context) return;
- WriteLock(&Context->PropLock);
+ almtx_lock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -1815,7 +1815,7 @@ AL_API ALvoid AL_APIENTRY alSourcefv(ALuint source, ALenum param, const ALfloat
else
SetSourcefv(Source, Context, param, values);
UnlockSourceList(Context);
- WriteUnlock(&Context->PropLock);
+ almtx_unlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -1829,7 +1829,7 @@ AL_API ALvoid AL_APIENTRY alSourcedSOFT(ALuint source, ALenum param, ALdouble va
Context = GetContextRef();
if(!Context) return;
- WriteLock(&Context->PropLock);
+ almtx_lock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -1841,7 +1841,7 @@ AL_API ALvoid AL_APIENTRY alSourcedSOFT(ALuint source, ALenum param, ALdouble va
SetSourcefv(Source, Context, param, &fval);
}
UnlockSourceList(Context);
- WriteUnlock(&Context->PropLock);
+ almtx_unlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -1854,7 +1854,7 @@ AL_API ALvoid AL_APIENTRY alSource3dSOFT(ALuint source, ALenum param, ALdouble v
Context = GetContextRef();
if(!Context) return;
- WriteLock(&Context->PropLock);
+ almtx_lock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -1866,7 +1866,7 @@ AL_API ALvoid AL_APIENTRY alSource3dSOFT(ALuint source, ALenum param, ALdouble v
SetSourcefv(Source, Context, param, fvals);
}
UnlockSourceList(Context);
- WriteUnlock(&Context->PropLock);
+ almtx_unlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -1880,7 +1880,7 @@ AL_API ALvoid AL_APIENTRY alSourcedvSOFT(ALuint source, ALenum param, const ALdo
Context = GetContextRef();
if(!Context) return;
- WriteLock(&Context->PropLock);
+ almtx_lock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -1898,7 +1898,7 @@ AL_API ALvoid AL_APIENTRY alSourcedvSOFT(ALuint source, ALenum param, const ALdo
SetSourcefv(Source, Context, param, fvals);
}
UnlockSourceList(Context);
- WriteUnlock(&Context->PropLock);
+ almtx_unlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -1912,7 +1912,7 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source, ALenum param, ALint value)
Context = GetContextRef();
if(!Context) return;
- WriteLock(&Context->PropLock);
+ almtx_lock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -1921,7 +1921,7 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source, ALenum param, ALint value)
else
SetSourceiv(Source, Context, param, &value);
UnlockSourceList(Context);
- WriteUnlock(&Context->PropLock);
+ almtx_unlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -1934,7 +1934,7 @@ AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum param, ALint value1, AL
Context = GetContextRef();
if(!Context) return;
- WriteLock(&Context->PropLock);
+ almtx_lock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -1946,7 +1946,7 @@ AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum param, ALint value1, AL
SetSourceiv(Source, Context, param, ivals);
}
UnlockSourceList(Context);
- WriteUnlock(&Context->PropLock);
+ almtx_unlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -1959,7 +1959,7 @@ AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum param, const ALint *val
Context = GetContextRef();
if(!Context) return;
- WriteLock(&Context->PropLock);
+ almtx_lock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -1970,7 +1970,7 @@ AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum param, const ALint *val
else
SetSourceiv(Source, Context, param, values);
UnlockSourceList(Context);
- WriteUnlock(&Context->PropLock);
+ almtx_unlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -1984,7 +1984,7 @@ AL_API ALvoid AL_APIENTRY alSourcei64SOFT(ALuint source, ALenum param, ALint64SO
Context = GetContextRef();
if(!Context) return;
- WriteLock(&Context->PropLock);
+ almtx_lock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -1993,7 +1993,7 @@ AL_API ALvoid AL_APIENTRY alSourcei64SOFT(ALuint source, ALenum param, ALint64SO
else
SetSourcei64v(Source, Context, param, &value);
UnlockSourceList(Context);
- WriteUnlock(&Context->PropLock);
+ almtx_unlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -2006,7 +2006,7 @@ AL_API void AL_APIENTRY alSource3i64SOFT(ALuint source, ALenum param, ALint64SOF
Context = GetContextRef();
if(!Context) return;
- WriteLock(&Context->PropLock);
+ almtx_lock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -2018,7 +2018,7 @@ AL_API void AL_APIENTRY alSource3i64SOFT(ALuint source, ALenum param, ALint64SOF
SetSourcei64v(Source, Context, param, i64vals);
}
UnlockSourceList(Context);
- WriteUnlock(&Context->PropLock);
+ almtx_unlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -2031,7 +2031,7 @@ AL_API void AL_APIENTRY alSourcei64vSOFT(ALuint source, ALenum param, const ALin
Context = GetContextRef();
if(!Context) return;
- WriteLock(&Context->PropLock);
+ almtx_lock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -2042,7 +2042,7 @@ AL_API void AL_APIENTRY alSourcei64vSOFT(ALuint source, ALenum param, const ALin
else
SetSourcei64v(Source, Context, param, values);
UnlockSourceList(Context);
- WriteUnlock(&Context->PropLock);
+ almtx_unlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -2056,7 +2056,6 @@ AL_API ALvoid AL_APIENTRY alGetSourcef(ALuint source, ALenum param, ALfloat *val
Context = GetContextRef();
if(!Context) return;
- ReadLock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -2071,7 +2070,6 @@ AL_API ALvoid AL_APIENTRY alGetSourcef(ALuint source, ALenum param, ALfloat *val
*value = (ALfloat)dval;
}
UnlockSourceList(Context);
- ReadUnlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -2085,7 +2083,6 @@ AL_API ALvoid AL_APIENTRY alGetSource3f(ALuint source, ALenum param, ALfloat *va
Context = GetContextRef();
if(!Context) return;
- ReadLock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -2104,7 +2101,6 @@ AL_API ALvoid AL_APIENTRY alGetSource3f(ALuint source, ALenum param, ALfloat *va
}
}
UnlockSourceList(Context);
- ReadUnlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -2119,7 +2115,6 @@ AL_API ALvoid AL_APIENTRY alGetSourcefv(ALuint source, ALenum param, ALfloat *va
Context = GetContextRef();
if(!Context) return;
- ReadLock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -2138,7 +2133,6 @@ AL_API ALvoid AL_APIENTRY alGetSourcefv(ALuint source, ALenum param, ALfloat *va
}
}
UnlockSourceList(Context);
- ReadUnlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -2152,7 +2146,6 @@ AL_API void AL_APIENTRY alGetSourcedSOFT(ALuint source, ALenum param, ALdouble *
Context = GetContextRef();
if(!Context) return;
- ReadLock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -2163,7 +2156,6 @@ AL_API void AL_APIENTRY alGetSourcedSOFT(ALuint source, ALenum param, ALdouble *
else
GetSourcedv(Source, Context, param, value);
UnlockSourceList(Context);
- ReadUnlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -2176,7 +2168,6 @@ AL_API void AL_APIENTRY alGetSource3dSOFT(ALuint source, ALenum param, ALdouble
Context = GetContextRef();
if(!Context) return;
- ReadLock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -2195,7 +2186,6 @@ AL_API void AL_APIENTRY alGetSource3dSOFT(ALuint source, ALenum param, ALdouble
}
}
UnlockSourceList(Context);
- ReadUnlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -2208,7 +2198,6 @@ AL_API void AL_APIENTRY alGetSourcedvSOFT(ALuint source, ALenum param, ALdouble
Context = GetContextRef();
if(!Context) return;
- ReadLock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -2219,7 +2208,6 @@ AL_API void AL_APIENTRY alGetSourcedvSOFT(ALuint source, ALenum param, ALdouble
else
GetSourcedv(Source, Context, param, values);
UnlockSourceList(Context);
- ReadUnlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -2233,7 +2221,6 @@ AL_API ALvoid AL_APIENTRY alGetSourcei(ALuint source, ALenum param, ALint *value
Context = GetContextRef();
if(!Context) return;
- ReadLock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -2244,7 +2231,6 @@ AL_API ALvoid AL_APIENTRY alGetSourcei(ALuint source, ALenum param, ALint *value
else
GetSourceiv(Source, Context, param, value);
UnlockSourceList(Context);
- ReadUnlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -2258,7 +2244,6 @@ AL_API void AL_APIENTRY alGetSource3i(ALuint source, ALenum param, ALint *value1
Context = GetContextRef();
if(!Context) return;
- ReadLock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -2277,7 +2262,6 @@ AL_API void AL_APIENTRY alGetSource3i(ALuint source, ALenum param, ALint *value1
}
}
UnlockSourceList(Context);
- ReadUnlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -2291,7 +2275,6 @@ AL_API void AL_APIENTRY alGetSourceiv(ALuint source, ALenum param, ALint *values
Context = GetContextRef();
if(!Context) return;
- ReadLock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -2302,7 +2285,6 @@ AL_API void AL_APIENTRY alGetSourceiv(ALuint source, ALenum param, ALint *values
else
GetSourceiv(Source, Context, param, values);
UnlockSourceList(Context);
- ReadUnlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -2316,7 +2298,6 @@ AL_API void AL_APIENTRY alGetSourcei64SOFT(ALuint source, ALenum param, ALint64S
Context = GetContextRef();
if(!Context) return;
- ReadLock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -2327,7 +2308,6 @@ AL_API void AL_APIENTRY alGetSourcei64SOFT(ALuint source, ALenum param, ALint64S
else
GetSourcei64v(Source, Context, param, value);
UnlockSourceList(Context);
- ReadUnlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -2340,7 +2320,6 @@ AL_API void AL_APIENTRY alGetSource3i64SOFT(ALuint source, ALenum param, ALint64
Context = GetContextRef();
if(!Context) return;
- ReadLock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -2359,7 +2338,6 @@ AL_API void AL_APIENTRY alGetSource3i64SOFT(ALuint source, ALenum param, ALint64
}
}
UnlockSourceList(Context);
- ReadUnlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
@@ -2372,7 +2350,6 @@ AL_API void AL_APIENTRY alGetSourcei64vSOFT(ALuint source, ALenum param, ALint64
Context = GetContextRef();
if(!Context) return;
- ReadLock(&Context->PropLock);
LockSourceList(Context);
if((Source=LookupSource(Context, source)) == NULL)
alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
@@ -2383,7 +2360,6 @@ AL_API void AL_APIENTRY alGetSourcei64vSOFT(ALuint source, ALenum param, ALint64
else
GetSourcei64v(Source, Context, param, values);
UnlockSourceList(Context);
- ReadUnlock(&Context->PropLock);
ALCcontext_DecRef(Context);
}
diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c
index 8448e548..460c93e0 100644
--- a/OpenAL32/alState.c
+++ b/OpenAL32/alState.c
@@ -79,7 +79,7 @@ AL_API ALvoid AL_APIENTRY alEnable(ALenum capability)
context = GetContextRef();
if(!context) return;
- WriteLock(&context->PropLock);
+ almtx_lock(&context->PropLock);
switch(capability)
{
case AL_SOURCE_DISTANCE_MODEL:
@@ -90,7 +90,7 @@ AL_API ALvoid AL_APIENTRY alEnable(ALenum capability)
default:
alSetError(context, AL_INVALID_VALUE, "Invalid enable property 0x%04x", capability);
}
- WriteUnlock(&context->PropLock);
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
}
@@ -102,7 +102,7 @@ AL_API ALvoid AL_APIENTRY alDisable(ALenum capability)
context = GetContextRef();
if(!context) return;
- WriteLock(&context->PropLock);
+ almtx_lock(&context->PropLock);
switch(capability)
{
case AL_SOURCE_DISTANCE_MODEL:
@@ -113,7 +113,7 @@ AL_API ALvoid AL_APIENTRY alDisable(ALenum capability)
default:
alSetError(context, AL_INVALID_VALUE, "Invalid disable property 0x%04x", capability);
}
- WriteUnlock(&context->PropLock);
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
}
@@ -700,10 +700,10 @@ AL_API ALvoid AL_APIENTRY alDopplerFactor(ALfloat value)
alSetError(context, AL_INVALID_VALUE, "Doppler factor %f out of range", value);
else
{
- WriteLock(&context->PropLock);
+ almtx_lock(&context->PropLock);
context->DopplerFactor = value;
DO_UPDATEPROPS();
- WriteUnlock(&context->PropLock);
+ almtx_unlock(&context->PropLock);
}
ALCcontext_DecRef(context);
@@ -734,10 +734,10 @@ AL_API ALvoid AL_APIENTRY alDopplerVelocity(ALfloat value)
alSetError(context, AL_INVALID_VALUE, "Doppler velocity %f out of range", value);
else
{
- WriteLock(&context->PropLock);
+ almtx_lock(&context->PropLock);
context->DopplerVelocity = value;
DO_UPDATEPROPS();
- WriteUnlock(&context->PropLock);
+ almtx_unlock(&context->PropLock);
}
ALCcontext_DecRef(context);
@@ -754,10 +754,10 @@ AL_API ALvoid AL_APIENTRY alSpeedOfSound(ALfloat value)
alSetError(context, AL_INVALID_VALUE, "Speed of sound %f out of range", value);
else
{
- WriteLock(&context->PropLock);
+ almtx_lock(&context->PropLock);
context->SpeedOfSound = value;
DO_UPDATEPROPS();
- WriteUnlock(&context->PropLock);
+ almtx_unlock(&context->PropLock);
}
ALCcontext_DecRef(context);
@@ -777,11 +777,11 @@ AL_API ALvoid AL_APIENTRY alDistanceModel(ALenum value)
alSetError(context, AL_INVALID_VALUE, "Distance model 0x%04x out of range", value);
else
{
- WriteLock(&context->PropLock);
+ almtx_lock(&context->PropLock);
context->DistanceModel = value;
if(!context->SourceDistanceModel)
DO_UPDATEPROPS();
- WriteUnlock(&context->PropLock);
+ almtx_unlock(&context->PropLock);
}
ALCcontext_DecRef(context);