aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-09-03 15:40:15 -0700
committerChris Robinson <[email protected]>2014-09-03 15:40:15 -0700
commit5840f5e76f2b803589074de254f282a5844c77ee (patch)
treedd2c7418acfcd6b5c3cb86c3be925e83df229e88
parentba827cdfffb386e00c9f96cb605980dafef304ae (diff)
Make the buffer's pack and unpack properties atomic
-rw-r--r--OpenAL32/Include/alBuffer.h4
-rw-r--r--OpenAL32/alBuffer.c18
2 files changed, 11 insertions, 11 deletions
diff --git a/OpenAL32/Include/alBuffer.h b/OpenAL32/Include/alBuffer.h
index 557f2282..b67c7034 100644
--- a/OpenAL32/Include/alBuffer.h
+++ b/OpenAL32/Include/alBuffer.h
@@ -85,8 +85,8 @@ typedef struct ALbuffer {
ALsizei LoopStart;
ALsizei LoopEnd;
- ALsizei UnpackAlign;
- ALsizei PackAlign;
+ ATOMIC(ALsizei) UnpackAlign;
+ ATOMIC(ALsizei) PackAlign;
/* Number of times buffer was attached to a source (deletion can only occur when 0) */
RefCount ref;
diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c
index 4cd37024..c82b8833 100644
--- a/OpenAL32/alBuffer.c
+++ b/OpenAL32/alBuffer.c
@@ -151,7 +151,7 @@ AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer, ALenum format, const ALvoi
if(DecomposeUserFormat(format, &srcchannels, &srctype) == AL_FALSE)
SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
- align = albuf->UnpackAlign;
+ align = ATOMIC_LOAD(&albuf->UnpackAlign);
if(SanitizeAlignment(srctype, &align) == AL_FALSE)
SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
switch(srctype)
@@ -291,7 +291,7 @@ AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer, ALenum format, cons
SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
WriteLock(&albuf->lock);
- align = albuf->UnpackAlign;
+ align = ATOMIC_LOAD(&albuf->UnpackAlign);
if(SanitizeAlignment(srctype, &align) == AL_FALSE)
{
WriteUnlock(&albuf->lock);
@@ -368,7 +368,7 @@ AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint buffer,
if(IsValidType(type) == AL_FALSE || IsValidChannels(channels) == AL_FALSE)
SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
- align = albuf->UnpackAlign;
+ align = ATOMIC_LOAD(&albuf->UnpackAlign);
if(SanitizeAlignment(type, &align) == AL_FALSE)
SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
if((samples%align) != 0)
@@ -404,7 +404,7 @@ AL_API void AL_APIENTRY alBufferSubSamplesSOFT(ALuint buffer,
SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
WriteLock(&albuf->lock);
- align = albuf->UnpackAlign;
+ align = ATOMIC_LOAD(&albuf->UnpackAlign);
if(SanitizeAlignment(type, &align) == AL_FALSE)
{
WriteUnlock(&albuf->lock);
@@ -457,7 +457,7 @@ AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint buffer,
SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
ReadLock(&albuf->lock);
- align = albuf->PackAlign;
+ align = ATOMIC_LOAD(&albuf->PackAlign);
if(SanitizeAlignment(type, &align) == AL_FALSE)
{
ReadUnlock(&albuf->lock);
@@ -596,13 +596,13 @@ AL_API void AL_APIENTRY alBufferi(ALuint buffer, ALenum param, ALint value)
case AL_UNPACK_BLOCK_ALIGNMENT_SOFT:
if(!(value >= 0))
SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
- ExchangeInt(&albuf->UnpackAlign, value);
+ ATOMIC_STORE(&albuf->UnpackAlign, value);
break;
case AL_PACK_BLOCK_ALIGNMENT_SOFT:
if(!(value >= 0))
SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
- ExchangeInt(&albuf->PackAlign, value);
+ ATOMIC_STORE(&albuf->PackAlign, value);
break;
default:
@@ -834,11 +834,11 @@ AL_API ALvoid AL_APIENTRY alGetBufferi(ALuint buffer, ALenum param, ALint *value
break;
case AL_UNPACK_BLOCK_ALIGNMENT_SOFT:
- *value = albuf->UnpackAlign;
+ *value = ATOMIC_LOAD(&albuf->UnpackAlign);
break;
case AL_PACK_BLOCK_ALIGNMENT_SOFT:
- *value = albuf->PackAlign;
+ *value = ATOMIC_LOAD(&albuf->PackAlign);
break;
default: