aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-03-03 13:53:41 -0800
committerChris Robinson <[email protected]>2018-03-03 13:54:21 -0800
commitb8636a3dbff0a9003aa00d871fa20302cb82e36d (patch)
tree408f5c0fa23ca6c58a545722f51b80bb95b7d6b6 /OpenAL32
parent4e6c758daf1849741712eaf451f392264fd49244 (diff)
Add some missing locks to protect reading state
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/alState.c14
-rw-r--r--OpenAL32/event.c2
2 files changed, 16 insertions, 0 deletions
diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c
index 460c93e0..ce93e143 100644
--- a/OpenAL32/alState.c
+++ b/OpenAL32/alState.c
@@ -126,6 +126,7 @@ AL_API ALboolean AL_APIENTRY alIsEnabled(ALenum capability)
context = GetContextRef();
if(!context) return AL_FALSE;
+ almtx_lock(&context->PropLock);
switch(capability)
{
case AL_SOURCE_DISTANCE_MODEL:
@@ -135,6 +136,7 @@ AL_API ALboolean AL_APIENTRY alIsEnabled(ALenum capability)
default:
alSetError(context, AL_INVALID_VALUE, "Invalid is enabled property 0x%04x", capability);
}
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
return value;
@@ -148,6 +150,7 @@ AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum pname)
context = GetContextRef();
if(!context) return AL_FALSE;
+ almtx_lock(&context->PropLock);
switch(pname)
{
case AL_DOPPLER_FACTOR:
@@ -192,6 +195,7 @@ AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum pname)
default:
alSetError(context, AL_INVALID_VALUE, "Invalid boolean property 0x%04x", pname);
}
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
return value;
@@ -205,6 +209,7 @@ AL_API ALdouble AL_APIENTRY alGetDouble(ALenum pname)
context = GetContextRef();
if(!context) return 0.0;
+ almtx_lock(&context->PropLock);
switch(pname)
{
case AL_DOPPLER_FACTOR:
@@ -243,6 +248,7 @@ AL_API ALdouble AL_APIENTRY alGetDouble(ALenum pname)
default:
alSetError(context, AL_INVALID_VALUE, "Invalid double property 0x%04x", pname);
}
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
return value;
@@ -256,6 +262,7 @@ AL_API ALfloat AL_APIENTRY alGetFloat(ALenum pname)
context = GetContextRef();
if(!context) return 0.0f;
+ almtx_lock(&context->PropLock);
switch(pname)
{
case AL_DOPPLER_FACTOR:
@@ -294,6 +301,7 @@ AL_API ALfloat AL_APIENTRY alGetFloat(ALenum pname)
default:
alSetError(context, AL_INVALID_VALUE, "Invalid float property 0x%04x", pname);
}
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
return value;
@@ -307,6 +315,7 @@ AL_API ALint AL_APIENTRY alGetInteger(ALenum pname)
context = GetContextRef();
if(!context) return 0;
+ almtx_lock(&context->PropLock);
switch(pname)
{
case AL_DOPPLER_FACTOR:
@@ -345,6 +354,7 @@ AL_API ALint AL_APIENTRY alGetInteger(ALenum pname)
default:
alSetError(context, AL_INVALID_VALUE, "Invalid integer property 0x%04x", pname);
}
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
return value;
@@ -358,6 +368,7 @@ AL_API ALint64SOFT AL_APIENTRY alGetInteger64SOFT(ALenum pname)
context = GetContextRef();
if(!context) return 0;
+ almtx_lock(&context->PropLock);
switch(pname)
{
case AL_DOPPLER_FACTOR:
@@ -396,6 +407,7 @@ AL_API ALint64SOFT AL_APIENTRY alGetInteger64SOFT(ALenum pname)
default:
alSetError(context, AL_INVALID_VALUE, "Invalid integer64 property 0x%04x", pname);
}
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
return value;
@@ -409,6 +421,7 @@ AL_API void* AL_APIENTRY alGetPointerSOFT(ALenum pname)
context = GetContextRef();
if(!context) return NULL;
+ almtx_lock(&context->PropLock);
switch(pname)
{
case AL_EVENT_CALLBACK_FUNCTION_SOFT:
@@ -422,6 +435,7 @@ AL_API void* AL_APIENTRY alGetPointerSOFT(ALenum pname)
default:
alSetError(context, AL_INVALID_VALUE, "Invalid pointer property 0x%04x", pname);
}
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
return value;
diff --git a/OpenAL32/event.c b/OpenAL32/event.c
index 333b7613..6fd2e96f 100644
--- a/OpenAL32/event.c
+++ b/OpenAL32/event.c
@@ -134,10 +134,12 @@ AL_API void AL_APIENTRY alEventCallbackSOFT(ALEVENTPROCSOFT callback, void *user
context = GetContextRef();
if(!context) return;
+ almtx_lock(&context->PropLock);
almtx_lock(&context->EventCbLock);
context->EventCb = callback;
context->EventParam = userParam;
almtx_unlock(&context->EventCbLock);
+ almtx_unlock(&context->PropLock);
ALCcontext_DecRef(context);
}