aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-04-14 17:47:55 -0700
committerChris Robinson <[email protected]>2017-04-14 17:47:55 -0700
commitf94fa5d5cfb78ab5438a53b2ad17f033660103c9 (patch)
tree51e9f2b06bb77389fb6237917a2f7462402c8cab /Alc
parent9e60eea93b029f1c2d2e394e2352b86cd7c65d12 (diff)
Use separate atomic macros for pointers
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c36
-rw-r--r--Alc/ALu.c12
-rw-r--r--Alc/backends/opensl.c4
-rw-r--r--Alc/backends/oss.c4
-rw-r--r--Alc/backends/solaris.c2
-rw-r--r--Alc/helpers.c4
6 files changed, 30 insertions, 32 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 2a636c59..cc9aa5c3 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1247,7 +1247,7 @@ static void alc_cleanup(void)
free(alcCaptureDefaultDeviceSpecifier);
alcCaptureDefaultDeviceSpecifier = NULL;
- if((dev=ATOMIC_EXCHANGE_SEQ(ALCdevice*, &DeviceList, NULL)) != NULL)
+ if((dev=ATOMIC_EXCHANGE_PTR_SEQ(&DeviceList, NULL)) != NULL)
{
ALCuint num = 0;
do {
@@ -1678,7 +1678,7 @@ void ALCcontext_DeferUpdates(ALCcontext *context)
void ALCcontext_ProcessUpdates(ALCcontext *context)
{
ReadLock(&context->PropLock);
- if(ATOMIC_EXCHANGE_SEQ(ALenum, &context->DeferUpdates, AL_FALSE))
+ if(ATOMIC_EXCHANGE_SEQ(&context->DeferUpdates, AL_FALSE))
{
/* Tell the mixer to stop applying updates, then wait for any active
* updating to finish, before providing updates.
@@ -2225,11 +2225,10 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
* number of auxiliary sends changed. Playing (or paused) sources
* will have updates respecified in UpdateAllSourceProps.
*/
- props = ATOMIC_EXCHANGE_SEQ(struct ALsourceProps*, &source->Update, NULL);
+ props = ATOMIC_EXCHANGE_PTR_SEQ(&source->Update, NULL);
al_free(props);
- props = ATOMIC_EXCHANGE(struct ALsourceProps*, &source->FreeList, NULL,
- almemory_order_relaxed);
+ props = ATOMIC_EXCHANGE_PTR(&source->FreeList, NULL, almemory_order_relaxed);
while(props)
{
struct ALsourceProps *next = ATOMIC_LOAD(&props->next, almemory_order_relaxed);
@@ -2489,8 +2488,7 @@ static void FreeContext(ALCcontext *context)
TRACE("%p\n", context);
- auxslots = ATOMIC_EXCHANGE(struct ALeffectslotArray*, &context->ActiveAuxSlots,
- NULL, almemory_order_relaxed);
+ auxslots = ATOMIC_EXCHANGE_PTR(&context->ActiveAuxSlots, NULL, almemory_order_relaxed);
al_free(auxslots);
if(context->SourceMap.size > 0)
@@ -2557,13 +2555,13 @@ static bool ReleaseContext(ALCcontext *context, ALCdevice *device)
}
origctx = context;
- if(ATOMIC_COMPARE_EXCHANGE_STRONG_SEQ(ALCcontext*, &GlobalContext, &origctx, NULL))
+ if(ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&GlobalContext, &origctx, NULL))
ALCcontext_DecRef(context);
ALCdevice_Lock(device);
origctx = context;
newhead = context->next;
- if(!ATOMIC_COMPARE_EXCHANGE_STRONG_SEQ(ALCcontext*, &device->ContextList, &origctx, newhead))
+ if(!ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&device->ContextList, &origctx, newhead))
{
ALCcontext *volatile*list = &origctx->next;
while(*list)
@@ -2750,11 +2748,11 @@ ALC_API ALCenum ALC_APIENTRY alcGetError(ALCdevice *device)
if(VerifyDevice(&device))
{
- errorCode = ATOMIC_EXCHANGE_SEQ(ALCenum, &device->LastError, ALC_NO_ERROR);
+ errorCode = ATOMIC_EXCHANGE_SEQ(&device->LastError, ALC_NO_ERROR);
ALCdevice_DecRef(device);
}
else
- errorCode = ATOMIC_EXCHANGE_SEQ(ALCenum, &LastNullDeviceError, ALC_NO_ERROR);
+ errorCode = ATOMIC_EXCHANGE_SEQ(&LastNullDeviceError, ALC_NO_ERROR);
return errorCode;
}
@@ -3549,8 +3547,8 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin
ALCcontext *head = ATOMIC_LOAD_SEQ(&device->ContextList);
do {
ALContext->next = head;
- } while(ATOMIC_COMPARE_EXCHANGE_WEAK_SEQ(ALCcontext*,
- &device->ContextList, &head, ALContext) == 0);
+ } while(ATOMIC_COMPARE_EXCHANGE_PTR_WEAK_SEQ(&device->ContextList, &head,
+ ALContext) == 0);
}
almtx_unlock(&device->BackendLock);
@@ -3628,7 +3626,7 @@ ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent(ALCcontext *context)
return ALC_FALSE;
}
/* context's reference count is already incremented */
- context = ATOMIC_EXCHANGE_SEQ(ALCcontext*, &GlobalContext, context);
+ context = ATOMIC_EXCHANGE_PTR_SEQ(&GlobalContext, context);
if(context) ALCcontext_DecRef(context);
if((context=altss_get(LocalContext)) != NULL)
@@ -3937,7 +3935,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
ALCdevice *head = ATOMIC_LOAD_SEQ(&DeviceList);
do {
device->next = head;
- } while(!ATOMIC_COMPARE_EXCHANGE_WEAK_SEQ(ALCdevice*, &DeviceList, &head, device));
+ } while(!ATOMIC_COMPARE_EXCHANGE_PTR_WEAK_SEQ(&DeviceList, &head, device));
}
TRACE("Created device %p, \"%s\"\n", device, alstr_get_cstr(device->DeviceName));
@@ -3968,7 +3966,7 @@ ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *device)
almtx_lock(&device->BackendLock);
origdev = device;
- if(!ATOMIC_COMPARE_EXCHANGE_STRONG_SEQ(ALCdevice*, &DeviceList, &origdev, device->next))
+ if(!ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&DeviceList, &origdev, device->next))
{
ALCdevice *volatile*list = &origdev->next;
while(*list)
@@ -4113,7 +4111,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *deviceName,
ALCdevice *head = ATOMIC_LOAD_SEQ(&DeviceList);
do {
device->next = head;
- } while(!ATOMIC_COMPARE_EXCHANGE_WEAK_SEQ(ALCdevice*, &DeviceList, &head, device));
+ } while(!ATOMIC_COMPARE_EXCHANGE_PTR_WEAK_SEQ(&DeviceList, &head, device));
}
TRACE("Created device %p, \"%s\"\n", device, alstr_get_cstr(device->DeviceName));
@@ -4138,7 +4136,7 @@ ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice(ALCdevice *device)
}
origdev = device;
- if(!ATOMIC_COMPARE_EXCHANGE_STRONG_SEQ(ALCdevice*, &DeviceList, &origdev, device->next))
+ if(!ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&DeviceList, &origdev, device->next))
{
ALCdevice *volatile*list = &origdev->next;
while(*list)
@@ -4334,7 +4332,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceN
ALCdevice *head = ATOMIC_LOAD_SEQ(&DeviceList);
do {
device->next = head;
- } while(!ATOMIC_COMPARE_EXCHANGE_WEAK_SEQ(ALCdevice*, &DeviceList, &head, device));
+ } while(!ATOMIC_COMPARE_EXCHANGE_PTR_WEAK_SEQ(&DeviceList, &head, device));
}
TRACE("Created device %p\n", device);
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 4f41d012..89689fba 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -241,7 +241,7 @@ static ALboolean CalcListenerParams(ALCcontext *Context)
struct ALlistenerProps *props;
aluVector vel;
- props = ATOMIC_EXCHANGE(struct ALlistenerProps*, &Listener->Update, NULL, almemory_order_acq_rel);
+ props = ATOMIC_EXCHANGE_PTR(&Listener->Update, NULL, almemory_order_acq_rel);
if(!props) return AL_FALSE;
/* AT then UP */
@@ -291,7 +291,7 @@ static ALboolean CalcEffectSlotParams(ALeffectslot *slot, ALCdevice *device)
struct ALeffectslotProps *props;
ALeffectState *state;
- props = ATOMIC_EXCHANGE(struct ALeffectslotProps*, &slot->Update, NULL, almemory_order_acq_rel);
+ props = ATOMIC_EXCHANGE_PTR(&slot->Update, NULL, almemory_order_acq_rel);
if(!props) return AL_FALSE;
slot->Params.Gain = props->Gain;
@@ -1252,7 +1252,7 @@ static void CalcSourceParams(ALvoice *voice, ALsource *source, ALCcontext *conte
const ALbufferlistitem *BufferListItem;
struct ALsourceProps *props;
- props = ATOMIC_EXCHANGE(struct ALsourceProps*, &source->Update, NULL, almemory_order_acq_rel);
+ props = ATOMIC_EXCHANGE_PTR(&source->Update, NULL, almemory_order_acq_rel);
if(!props && !force) return;
if(props)
@@ -1607,14 +1607,14 @@ void aluHandleDisconnect(ALCdevice *device)
voice_end = voice + Context->VoiceCount;
while(voice != voice_end)
{
- ALsource *source = ATOMIC_EXCHANGE(ALsource*, &(*voice)->Source, NULL,
- almemory_order_acq_rel);
+ ALsource *source = ATOMIC_EXCHANGE_PTR(&(*voice)->Source, NULL,
+ almemory_order_acq_rel);
ATOMIC_STORE(&(*voice)->Playing, false, almemory_order_release);
if(source)
{
ALenum playing = AL_PLAYING;
- ATOMIC_COMPARE_EXCHANGE_STRONG_SEQ(ALenum, &source->state, &playing, AL_STOPPED);
+ (void)(ATOMIC_COMPARE_EXCHANGE_STRONG_SEQ(&source->state, &playing, AL_STOPPED));
}
voice++;
diff --git a/Alc/backends/opensl.c b/Alc/backends/opensl.c
index 622437b8..4e295f23 100644
--- a/Alc/backends/opensl.c
+++ b/Alc/backends/opensl.c
@@ -149,7 +149,7 @@ typedef struct ALCopenslPlayback {
ALsizei mFrameSize;
- ATOMIC(ALboolean) mKillNow;
+ ATOMIC(ALenum) mKillNow;
althrd_t mThread;
} ALCopenslPlayback;
@@ -637,7 +637,7 @@ static void ALCopenslPlayback_stop(ALCopenslPlayback *self)
SLresult result;
int res;
- if(ATOMIC_EXCHANGE_SEQ(ALboolean, &self->mKillNow, AL_TRUE))
+ if(ATOMIC_EXCHANGE_SEQ(&self->mKillNow, AL_TRUE))
return;
/* Lock the backend to ensure we don't flag the mixer to die and signal the
diff --git a/Alc/backends/oss.c b/Alc/backends/oss.c
index 6774a789..33ea55eb 100644
--- a/Alc/backends/oss.c
+++ b/Alc/backends/oss.c
@@ -491,7 +491,7 @@ static void ALCplaybackOSS_stop(ALCplaybackOSS *self)
{
int res;
- if(ATOMIC_EXCHANGE_SEQ(ALenum, &self->killNow, AL_TRUE))
+ if(ATOMIC_EXCHANGE_SEQ(&self->killNow, AL_TRUE))
return;
althrd_join(self->thread, &res);
@@ -745,7 +745,7 @@ static void ALCcaptureOSS_stop(ALCcaptureOSS *self)
{
int res;
- if(ATOMIC_EXCHANGE_SEQ(ALenum, &self->killNow, AL_TRUE))
+ if(ATOMIC_EXCHANGE_SEQ(&self->killNow, AL_TRUE))
return;
althrd_join(self->thread, &res);
diff --git a/Alc/backends/solaris.c b/Alc/backends/solaris.c
index 5b3f6136..5dfb5084 100644
--- a/Alc/backends/solaris.c
+++ b/Alc/backends/solaris.c
@@ -285,7 +285,7 @@ static void ALCsolarisBackend_stop(ALCsolarisBackend *self)
{
int res;
- if(ATOMIC_EXCHANGE_SEQ(int, &self->killNow, AL_TRUE))
+ if(ATOMIC_EXCHANGE_SEQ(&self->killNow, AL_TRUE))
return;
althrd_join(self->thread, &res);
diff --git a/Alc/helpers.c b/Alc/helpers.c
index 5d23c3a7..8e685c75 100644
--- a/Alc/helpers.c
+++ b/Alc/helpers.c
@@ -564,7 +564,7 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir)
vector_al_string results = VECTOR_INIT_STATIC();
size_t i;
- while(ATOMIC_EXCHANGE_SEQ(uint, &search_lock, 1) == 1)
+ while(ATOMIC_EXCHANGE_SEQ(&search_lock, 1) == 1)
althrd_yield();
/* If the path is absolute, use it directly. */
@@ -840,7 +840,7 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir)
static RefCount search_lock;
vector_al_string results = VECTOR_INIT_STATIC();
- while(ATOMIC_EXCHANGE_SEQ(uint, &search_lock, 1) == 1)
+ while(ATOMIC_EXCHANGE_SEQ(&search_lock, 1) == 1)
althrd_yield();
if(subdir[0] == '/')