Use an ATOMIC_INIT macro instead of ATOMIC_LOAD_UNSAFE
This commit is contained in:
parent
659b340716
commit
f5194a9d8e
18
Alc/ALc.c
18
Alc/ALc.c
@ -1882,7 +1882,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
|
|||||||
{
|
{
|
||||||
ALsizei pos;
|
ALsizei pos;
|
||||||
|
|
||||||
ATOMIC_STORE_UNSAFE(&context->UpdateSources, AL_FALSE);
|
ATOMIC_STORE(&context->UpdateSources, AL_FALSE);
|
||||||
LockUIntMapRead(&context->EffectSlotMap);
|
LockUIntMapRead(&context->EffectSlotMap);
|
||||||
for(pos = 0;pos < context->EffectSlotMap.size;pos++)
|
for(pos = 0;pos < context->EffectSlotMap.size;pos++)
|
||||||
{
|
{
|
||||||
@ -1914,7 +1914,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
|
|||||||
source->Send[s].GainHF = 1.0f;
|
source->Send[s].GainHF = 1.0f;
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
ATOMIC_STORE_UNSAFE(&source->NeedsUpdate, AL_TRUE);
|
ATOMIC_STORE(&source->NeedsUpdate, AL_TRUE);
|
||||||
}
|
}
|
||||||
UnlockUIntMapRead(&context->SourceMap);
|
UnlockUIntMapRead(&context->SourceMap);
|
||||||
|
|
||||||
@ -1931,7 +1931,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
|
|||||||
}
|
}
|
||||||
|
|
||||||
src->Update(src, context);
|
src->Update(src, context);
|
||||||
ATOMIC_STORE_UNSAFE(&source->NeedsUpdate, AL_FALSE);
|
ATOMIC_STORE(&source->NeedsUpdate, AL_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
context = context->next;
|
context = context->next;
|
||||||
@ -2110,8 +2110,8 @@ static ALvoid InitContext(ALCcontext *Context)
|
|||||||
Context->Listener->Params.Velocity[i] = 0.0f;
|
Context->Listener->Params.Velocity[i] = 0.0f;
|
||||||
|
|
||||||
//Validate Context
|
//Validate Context
|
||||||
ATOMIC_STORE_UNSAFE(&Context->LastError, AL_NO_ERROR);
|
ATOMIC_INIT(&Context->LastError, AL_NO_ERROR);
|
||||||
ATOMIC_STORE_UNSAFE(&Context->UpdateSources, AL_FALSE);
|
ATOMIC_INIT(&Context->UpdateSources, AL_FALSE);
|
||||||
Context->ActiveSourceCount = 0;
|
Context->ActiveSourceCount = 0;
|
||||||
InitUIntMap(&Context->SourceMap, Context->Device->MaxNoOfSources);
|
InitUIntMap(&Context->SourceMap, Context->Device->MaxNoOfSources);
|
||||||
InitUIntMap(&Context->EffectSlotMap, Context->Device->AuxiliaryEffectSlotMax);
|
InitUIntMap(&Context->EffectSlotMap, Context->Device->AuxiliaryEffectSlotMax);
|
||||||
@ -3076,14 +3076,14 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
|
|||||||
InitRef(&device->ref, 1);
|
InitRef(&device->ref, 1);
|
||||||
device->Connected = ALC_TRUE;
|
device->Connected = ALC_TRUE;
|
||||||
device->Type = Playback;
|
device->Type = Playback;
|
||||||
ATOMIC_STORE_UNSAFE(&device->LastError, ALC_NO_ERROR);
|
ATOMIC_INIT(&device->LastError, ALC_NO_ERROR);
|
||||||
|
|
||||||
device->Flags = 0;
|
device->Flags = 0;
|
||||||
device->Bs2b = NULL;
|
device->Bs2b = NULL;
|
||||||
device->Bs2bLevel = 0;
|
device->Bs2bLevel = 0;
|
||||||
AL_STRING_INIT(device->DeviceName);
|
AL_STRING_INIT(device->DeviceName);
|
||||||
|
|
||||||
ATOMIC_STORE_UNSAFE(&device->ContextList, NULL);
|
ATOMIC_INIT(&device->ContextList, NULL);
|
||||||
|
|
||||||
device->ClockBase = 0;
|
device->ClockBase = 0;
|
||||||
device->SamplesDone = 0;
|
device->SamplesDone = 0;
|
||||||
@ -3569,14 +3569,14 @@ ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceN
|
|||||||
InitRef(&device->ref, 1);
|
InitRef(&device->ref, 1);
|
||||||
device->Connected = ALC_TRUE;
|
device->Connected = ALC_TRUE;
|
||||||
device->Type = Loopback;
|
device->Type = Loopback;
|
||||||
ATOMIC_STORE_UNSAFE(&device->LastError, ALC_NO_ERROR);
|
ATOMIC_INIT(&device->LastError, ALC_NO_ERROR);
|
||||||
|
|
||||||
device->Flags = 0;
|
device->Flags = 0;
|
||||||
device->Bs2b = NULL;
|
device->Bs2b = NULL;
|
||||||
device->Bs2bLevel = 0;
|
device->Bs2bLevel = 0;
|
||||||
AL_STRING_INIT(device->DeviceName);
|
AL_STRING_INIT(device->DeviceName);
|
||||||
|
|
||||||
ATOMIC_STORE_UNSAFE(&device->ContextList, NULL);
|
ATOMIC_INIT(&device->ContextList, NULL);
|
||||||
|
|
||||||
device->ClockBase = 0;
|
device->ClockBase = 0;
|
||||||
device->SamplesDone = 0;
|
device->SamplesDone = 0;
|
||||||
|
@ -522,7 +522,7 @@ ALenum InitEffectSlot(ALeffectslot *slot)
|
|||||||
|
|
||||||
slot->Gain = 1.0;
|
slot->Gain = 1.0;
|
||||||
slot->AuxSendAuto = AL_TRUE;
|
slot->AuxSendAuto = AL_TRUE;
|
||||||
ATOMIC_STORE_UNSAFE(&slot->NeedsUpdate, AL_FALSE);
|
ATOMIC_INIT(&slot->NeedsUpdate, AL_FALSE);
|
||||||
for(c = 0;c < 1;c++)
|
for(c = 0;c < 1;c++)
|
||||||
{
|
{
|
||||||
for(i = 0;i < BUFFERSIZE;i++)
|
for(i = 0;i < BUFFERSIZE;i++)
|
||||||
|
@ -2423,8 +2423,8 @@ static ALvoid InitSourceParams(ALsource *Source)
|
|||||||
Source->SourceType = AL_UNDETERMINED;
|
Source->SourceType = AL_UNDETERMINED;
|
||||||
Source->Offset = -1.0;
|
Source->Offset = -1.0;
|
||||||
|
|
||||||
ATOMIC_STORE_UNSAFE(&Source->queue, NULL);
|
ATOMIC_INIT(&Source->queue, NULL);
|
||||||
ATOMIC_STORE_UNSAFE(&Source->current_buffer, NULL);
|
ATOMIC_INIT(&Source->current_buffer, NULL);
|
||||||
|
|
||||||
Source->Direct.Gain = 1.0f;
|
Source->Direct.Gain = 1.0f;
|
||||||
Source->Direct.GainHF = 1.0f;
|
Source->Direct.GainHF = 1.0f;
|
||||||
@ -2440,7 +2440,7 @@ static ALvoid InitSourceParams(ALsource *Source)
|
|||||||
Source->Send[i].LFReference = HIGHPASSFREQREF;
|
Source->Send[i].LFReference = HIGHPASSFREQREF;
|
||||||
}
|
}
|
||||||
|
|
||||||
ATOMIC_STORE_UNSAFE(&Source->NeedsUpdate, AL_TRUE);
|
ATOMIC_INIT(&Source->NeedsUpdate, AL_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,9 +21,9 @@ void RWLockInit(RWLock *lock)
|
|||||||
{
|
{
|
||||||
InitRef(&lock->read_count, 0);
|
InitRef(&lock->read_count, 0);
|
||||||
InitRef(&lock->write_count, 0);
|
InitRef(&lock->write_count, 0);
|
||||||
ATOMIC_STORE_UNSAFE(&lock->read_lock, false);
|
ATOMIC_INIT(&lock->read_lock, false);
|
||||||
ATOMIC_STORE_UNSAFE(&lock->read_entry_lock, false);
|
ATOMIC_INIT(&lock->read_entry_lock, false);
|
||||||
ATOMIC_STORE_UNSAFE(&lock->write_lock, false);
|
ATOMIC_INIT(&lock->write_lock, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReadLock(RWLock *lock)
|
void ReadLock(RWLock *lock)
|
||||||
|
@ -23,11 +23,9 @@ inline void *ExchangePtr(XchgPtr *ptr, void *newval)
|
|||||||
|
|
||||||
#define ATOMIC(T) struct { T _Atomic value; }
|
#define ATOMIC(T) struct { T _Atomic value; }
|
||||||
|
|
||||||
|
#define ATOMIC_INIT(_val, _newval) atomic_init(&(_val)->value, (_newval))
|
||||||
#define ATOMIC_INIT_STATIC(_newval) {ATOMIC_VAR_INIT(_newval)}
|
#define ATOMIC_INIT_STATIC(_newval) {ATOMIC_VAR_INIT(_newval)}
|
||||||
|
|
||||||
#define ATOMIC_LOAD_UNSAFE(_val) atomic_load_explicit(&(_val)->value, memory_order_relaxed)
|
|
||||||
#define ATOMIC_STORE_UNSAFE(_val, _newval) atomic_store_explicit(&(_val)->value, (_newval), memory_order_relaxed)
|
|
||||||
|
|
||||||
#define ATOMIC_LOAD(_val) atomic_load(&(_val)->value)
|
#define ATOMIC_LOAD(_val) atomic_load(&(_val)->value)
|
||||||
#define ATOMIC_STORE(_val, _newval) atomic_store(&(_val)->value, (_newval))
|
#define ATOMIC_STORE(_val, _newval) atomic_store(&(_val)->value, (_newval))
|
||||||
|
|
||||||
@ -51,13 +49,9 @@ inline void *ExchangePtr(XchgPtr *ptr, void *newval)
|
|||||||
|
|
||||||
#define ATOMIC(T) struct { T volatile value; }
|
#define ATOMIC(T) struct { T volatile value; }
|
||||||
|
|
||||||
|
#define ATOMIC_INIT(_val, _newval) do { (_val)->value = (_newval); } while(0)
|
||||||
#define ATOMIC_INIT_STATIC(_newval) {(_newval)}
|
#define ATOMIC_INIT_STATIC(_newval) {(_newval)}
|
||||||
|
|
||||||
#define ATOMIC_LOAD_UNSAFE(_val) __extension__({(_val)->value;})
|
|
||||||
#define ATOMIC_STORE_UNSAFE(_val, _newval) do { \
|
|
||||||
(_val)->value = (_newval); \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define ATOMIC_LOAD(_val) __extension__({ \
|
#define ATOMIC_LOAD(_val) __extension__({ \
|
||||||
__typeof((_val)->value) _r = (_val)->value; \
|
__typeof((_val)->value) _r = (_val)->value; \
|
||||||
__asm__ __volatile__("" ::: "memory"); \
|
__asm__ __volatile__("" ::: "memory"); \
|
||||||
@ -132,13 +126,9 @@ inline void *ExchangePtr(XchgPtr *dest, void *newval)
|
|||||||
|
|
||||||
#define ATOMIC(T) struct { T volatile value; }
|
#define ATOMIC(T) struct { T volatile value; }
|
||||||
|
|
||||||
|
#define ATOMIC_INIT(_val, _newval) do { (_val)->value = (_newval); } while(0)
|
||||||
#define ATOMIC_INIT_STATIC(_newval) {(_newval)}
|
#define ATOMIC_INIT_STATIC(_newval) {(_newval)}
|
||||||
|
|
||||||
#define ATOMIC_LOAD_UNSAFE(_val) __extension__({(_val)->value;})
|
|
||||||
#define ATOMIC_STORE_UNSAFE(_val, _newval) do { \
|
|
||||||
(_val)->value = (_newval); \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define ATOMIC_LOAD(_val) __extension__({ \
|
#define ATOMIC_LOAD(_val) __extension__({ \
|
||||||
__typeof((_val)->value) _r = (_val)->value; \
|
__typeof((_val)->value) _r = (_val)->value; \
|
||||||
__asm__ __volatile__("" ::: "memory"); \
|
__asm__ __volatile__("" ::: "memory"); \
|
||||||
@ -246,13 +236,9 @@ inline void *ExchangePtr(XchgPtr *ptr, void *newval)
|
|||||||
|
|
||||||
#define ATOMIC(T) struct { T volatile value; }
|
#define ATOMIC(T) struct { T volatile value; }
|
||||||
|
|
||||||
|
#define ATOMIC_INIT(_val, _newval) do { (_val)->value = (_newval); } while(0)
|
||||||
#define ATOMIC_INIT_STATIC(_newval) {(_newval)}
|
#define ATOMIC_INIT_STATIC(_newval) {(_newval)}
|
||||||
|
|
||||||
#define ATOMIC_LOAD_UNSAFE(_val) ((_val)->value)
|
|
||||||
#define ATOMIC_STORE_UNSAFE(_val, _newval) do { \
|
|
||||||
(_val)->value = (_newval); \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define ATOMIC_LOAD(_val) ((_val)->value)
|
#define ATOMIC_LOAD(_val) ((_val)->value)
|
||||||
#define ATOMIC_STORE(_val, _newval) do { \
|
#define ATOMIC_STORE(_val, _newval) do { \
|
||||||
(_val)->value = (_newval); \
|
(_val)->value = (_newval); \
|
||||||
@ -312,7 +298,7 @@ typedef unsigned int uint;
|
|||||||
typedef ATOMIC(uint) RefCount;
|
typedef ATOMIC(uint) RefCount;
|
||||||
|
|
||||||
inline void InitRef(RefCount *ptr, uint value)
|
inline void InitRef(RefCount *ptr, uint value)
|
||||||
{ ATOMIC_STORE_UNSAFE(ptr, value); }
|
{ ATOMIC_INIT(ptr, value); }
|
||||||
inline uint ReadRef(RefCount *ptr)
|
inline uint ReadRef(RefCount *ptr)
|
||||||
{ return ATOMIC_LOAD(ptr); }
|
{ return ATOMIC_LOAD(ptr); }
|
||||||
inline uint IncrementRef(RefCount *ptr)
|
inline uint IncrementRef(RefCount *ptr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user