Avoid using the ATOMIC() macro

This commit is contained in:
Chris Robinson
2018-11-26 14:48:26 -08:00
parent a6923790fa
commit 053599b243
14 changed files with 37 additions and 39 deletions
+11 -11
View File
@@ -71,7 +71,7 @@ struct ALCcontext_struct {
al::vector<ALeffectslotPtr> EffectSlotList;
almtx_t EffectSlotLock;
ATOMIC(ALenum) LastError{AL_NO_ERROR};
std::atomic<ALenum> LastError{AL_NO_ERROR};
DistanceModel mDistanceModel{DistanceModel::Default};
ALboolean SourceDistanceModel{AL_FALSE};
@@ -90,30 +90,30 @@ struct ALCcontext_struct {
* indicates if updates are currently happening).
*/
RefCount UpdateCount{0u};
ATOMIC(ALenum) HoldUpdates{AL_FALSE};
std::atomic<ALenum> HoldUpdates{AL_FALSE};
ALfloat GainBoost{1.0f};
ATOMIC(ALcontextProps*) Update{nullptr};
std::atomic<ALcontextProps*> Update{nullptr};
/* Linked lists of unused property containers, free to use for future
* updates.
*/
ATOMIC(ALcontextProps*) FreeContextProps{nullptr};
ATOMIC(ALlistenerProps*) FreeListenerProps{nullptr};
ATOMIC(ALvoiceProps*) FreeVoiceProps{nullptr};
ATOMIC(ALeffectslotProps*) FreeEffectslotProps{nullptr};
std::atomic<ALcontextProps*> FreeContextProps{nullptr};
std::atomic<ALlistenerProps*> FreeListenerProps{nullptr};
std::atomic<ALvoiceProps*> FreeVoiceProps{nullptr};
std::atomic<ALeffectslotProps*> FreeEffectslotProps{nullptr};
ALvoice **Voices{nullptr};
std::atomic<ALsizei> VoiceCount{0};
ALsizei MaxVoices{0};
ATOMIC(ALeffectslotArray*) ActiveAuxSlots{nullptr};
std::atomic<ALeffectslotArray*> ActiveAuxSlots{nullptr};
std::thread EventThread;
alsem_t EventSem;
ll_ringbuffer *AsyncEvents{nullptr};
ATOMIC(ALbitfieldSOFT) EnabledEvts{0u};
std::atomic<ALbitfieldSOFT> EnabledEvts{0u};
std::mutex EventCbLock;
ALEVENTPROCSOFT EventCb{};
void *EventParam{nullptr};
@@ -124,7 +124,7 @@ struct ALCcontext_struct {
ALCdevice *const Device;
const ALCchar *ExtensionList{nullptr};
ATOMIC(ALCcontext*) next{nullptr};
std::atomic<ALCcontext*> next{nullptr};
ALlistener Listener{};
@@ -199,7 +199,7 @@ struct ALcontextProps {
DistanceModel mDistanceModel;
ALfloat MetersPerUnit;
ATOMIC(struct ALcontextProps*) next;
std::atomic<ALcontextProps*> next;
};
#endif /* ALCONTEXT_H */
+1 -1
View File
@@ -151,7 +151,7 @@ struct ALCjackPlayback final : public ALCbackend {
ll_ringbuffer_t *Ring{nullptr};
alsem_t Sem;
ATOMIC(ALenum) killNow{AL_TRUE};
std::atomic<ALenum> killNow{AL_TRUE};
althrd_t thread;
};
+1 -1
View File
@@ -45,7 +45,7 @@ constexpr ALCchar nullDevice[] = "No Output";
struct ALCnullBackend final : public ALCbackend {
ATOMIC(int) killNow{AL_TRUE};
std::atomic<ALenum> killNow{AL_TRUE};
std::thread thread;
};
+1 -1
View File
@@ -148,7 +148,7 @@ struct ALCopenslPlayback final : public ALCbackend {
ALsizei mFrameSize{0};
ATOMIC(ALenum) mKillNow{AL_TRUE};
std::atomic<ALenum> mKillNow{AL_TRUE};
althrd_t mThread;
};
+1 -1
View File
@@ -51,7 +51,7 @@ struct qsa_data {
ALvoid* buffer;
ALsizei size;
ATOMIC(ALenum) killNow;
std::atomic<ALenum> killNow;
althrd_t thread;
};
+2 -2
View File
@@ -43,7 +43,7 @@ struct SndioPlayback final : public ALCbackend {
ALvoid *mix_data{nullptr};
ALsizei data_size{0};
ATOMIC(int) killNow{AL_TRUE};
std::atomic<ALenum> killNow{AL_TRUE};
althrd_t thread;
};
@@ -280,7 +280,7 @@ struct SndioCapture final : public ALCbackend {
ll_ringbuffer_t *ring{nullptr};
ATOMIC(int) killNow{AL_TRUE};
std::atomic<ALenum> killNow{AL_TRUE};
althrd_t thread;
};
+1 -1
View File
@@ -49,7 +49,7 @@ struct ALCsolarisBackend final : public ALCbackend {
ALubyte *mix_data{nullptr};
int data_size{0};
ATOMIC(ALenum) killNow{AL_TRUE};
std::atomic<ALenum> killNow{AL_TRUE};
althrd_t thread;
};
+1 -1
View File
@@ -84,7 +84,7 @@ struct ALCwaveBackend final : public ALCbackend {
al::vector<ALbyte> mBuffer;
ATOMIC(ALenum) killNow{AL_TRUE};
std::atomic<ALenum> killNow{AL_TRUE};
std::thread thread;
};
+2 -2
View File
@@ -54,7 +54,7 @@ struct ALeffectslotProps {
EffectState *State;
ATOMIC(struct ALeffectslotProps*) next;
std::atomic<ALeffectslotProps*> next;
};
@@ -73,7 +73,7 @@ struct ALeffectslot {
RefCount ref{0u};
ATOMIC(struct ALeffectslotProps*) Update{nullptr};
std::atomic<ALeffectslotProps*> Update{nullptr};
struct {
ALfloat Gain{1.0f};
+2 -2
View File
@@ -18,7 +18,7 @@ struct ALlistenerProps {
ALfloat Up[3];
ALfloat Gain;
ATOMIC(ALlistenerProps*) next;
std::atomic<ALlistenerProps*> next;
};
struct ALlistener {
@@ -32,7 +32,7 @@ struct ALlistener {
/* Pointer to the most recent property values that are awaiting an update.
*/
ATOMIC(ALlistenerProps*) Update{nullptr};
std::atomic<ALlistenerProps*> Update{nullptr};
struct {
aluMatrixf Matrix;
+4 -4
View File
@@ -667,7 +667,7 @@ typedef void (*POSTPROCESS)(ALCdevice *device, ALsizei SamplesToDo);
struct ALCdevice_struct {
RefCount ref{1u};
ATOMIC(ALenum) Connected{AL_TRUE};
std::atomic<ALenum> Connected{AL_TRUE};
DeviceType Type{};
ALuint Frequency{};
@@ -687,7 +687,7 @@ struct ALCdevice_struct {
std::string DeviceName;
ATOMIC(ALCenum) LastError{ALC_NO_ERROR};
std::atomic<ALCenum> LastError{ALC_NO_ERROR};
// Maximum number of sources that can be created
ALuint SourcesMax{};
@@ -783,12 +783,12 @@ struct ALCdevice_struct {
RefCount MixCount{0u};
// Contexts created on this device
ATOMIC(ALCcontext*) ContextList{nullptr};
std::atomic<ALCcontext*> ContextList{nullptr};
almtx_t BackendLock;
ALCbackend *Backend{nullptr};
ATOMIC(ALCdevice*) next{nullptr};
std::atomic<ALCdevice*> next{nullptr};
ALCdevice_struct(DeviceType type);
+1 -1
View File
@@ -19,7 +19,7 @@ struct ALsource;
typedef struct ALbufferlistitem {
ATOMIC(struct ALbufferlistitem*) next;
std::atomic<ALbufferlistitem*> next;
ALsizei max_samples;
ALsizei num_buffers;
struct ALbuffer *buffers[];
+9 -9
View File
@@ -144,7 +144,7 @@ typedef struct SendParams {
struct ALvoiceProps {
ATOMIC(struct ALvoiceProps*) next;
std::atomic<ALvoiceProps*> next;
ALfloat Pitch;
ALfloat Gain;
@@ -203,28 +203,28 @@ struct ALvoiceProps {
#define VOICE_HAS_NFC (1<<3)
typedef struct ALvoice {
struct ALvoiceProps *Props;
ALvoiceProps *Props;
ATOMIC(struct ALvoiceProps*) Update;
std::atomic<ALvoiceProps*> Update;
ATOMIC(struct ALsource*) Source;
ATOMIC(bool) Playing;
std::atomic<ALsource*> Source;
std::atomic<bool> Playing;
/**
* Source offset in samples, relative to the currently playing buffer, NOT
* the whole queue, and the fractional (fixed-point) offset to the next
* sample.
*/
ATOMIC(ALuint) position;
ATOMIC(ALsizei) position_fraction;
std::atomic<ALuint> position;
std::atomic<ALsizei> position_fraction;
/* Current buffer queue item being played. */
ATOMIC(struct ALbufferlistitem*) current_buffer;
std::atomic<ALbufferlistitem*> current_buffer;
/* Buffer queue item to loop to at end of queue (will be NULL for non-
* looping voices).
*/
ATOMIC(struct ALbufferlistitem*) loop_buffer;
std::atomic<ALbufferlistitem*> loop_buffer;
/**
* Number of channels and bytes-per-sample for the attached source's
-2
View File
@@ -12,8 +12,6 @@
#define almemory_order_acq_rel std::memory_order_acq_rel
#define almemory_order_seq_cst std::memory_order_seq_cst
#define ATOMIC(T) std::atomic<T>
#define ATOMIC_LOAD std::atomic_load_explicit
#define ATOMIC_STORE std::atomic_store_explicit