diff options
-rw-r--r-- | OpenAL32/alSource.c | 11 | ||||
-rw-r--r-- | common/atomic.c | 3 | ||||
-rw-r--r-- | include/atomic.h | 17 |
3 files changed, 7 insertions, 24 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 22774fa4..ec32ac8d 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -829,8 +829,10 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p { /* Add refcount on the new slot, and release the previous slot */ if(slot) IncrementRef(&slot->ref); - slot = ExchangePtr((XchgPtr*)&Source->Send[values[1]].Slot, slot); - if(slot) DecrementRef(&slot->ref); + if(Source->Send[values[1]].Slot) + DecrementRef(&Source->Send[values[1]].Slot->ref); + Source->Send[values[1]].Slot = slot; + /* We must force an update if the auxiliary slot changed on a * playing source, in case the slot is about to be deleted. */ @@ -839,8 +841,9 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p else { if(slot) IncrementRef(&slot->ref); - slot = ExchangePtr((XchgPtr*)&Source->Send[values[1]].Slot, slot); - if(slot) DecrementRef(&slot->ref); + if(Source->Send[values[1]].Slot) + DecrementRef(&Source->Send[values[1]].Slot->ref); + Source->Send[values[1]].Slot = slot; DO_UPDATEPROPS(); } diff --git a/common/atomic.c b/common/atomic.c index 3cdb77f4..7a8fe6d8 100644 --- a/common/atomic.c +++ b/common/atomic.c @@ -8,6 +8,3 @@ extern inline void InitRef(RefCount *ptr, uint value); extern inline uint ReadRef(RefCount *ptr); extern inline uint IncrementRef(RefCount *ptr); extern inline uint DecrementRef(RefCount *ptr); - -extern inline int ExchangeInt(volatile int *ptr, int newval); -extern inline void *ExchangePtr(XchgPtr *ptr, void *newval); diff --git a/include/atomic.h b/include/atomic.h index 8eb6820b..2a996625 100644 --- a/include/atomic.h +++ b/include/atomic.h @@ -305,23 +305,6 @@ inline uint DecrementRef(RefCount *ptr) { return ATOMIC_SUB(uint, ptr, 1)-1; } -/* NOTE: Not atomic! */ -inline int ExchangeInt(volatile int *ptr, int newval) -{ - int old = *ptr; - *ptr = newval; - return old; -} - -typedef void *volatile XchgPtr; -/* NOTE: Not atomic! */ -inline void *ExchangePtr(XchgPtr *ptr, void *newval) -{ - void *old = *ptr; - *ptr = newval; - return old; -} - /* This is *NOT* atomic, but is a handy utility macro to compare-and-swap non- * atomic variables. */ #define COMPARE_EXCHANGE(_val, _oldval, _newval) ((*(_val) == *(_oldval)) ? ((*(_val)=(_newval)),true) : ((*(_oldval)=*(_val)),false)) |