mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-09 09:24:24 +02:00
Rename SDL_atomic_t to SDL_AtomicInt
This commit is contained in:
committed by
Sam Lantinga
parent
8994878767
commit
d0c4849d0b
@@ -123,7 +123,7 @@ static SDL_INLINE void leaveLock(void *a)
|
||||
#endif
|
||||
|
||||
SDL_bool
|
||||
SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval)
|
||||
SDL_AtomicCAS(SDL_AtomicInt *a, int oldval, int newval)
|
||||
{
|
||||
#ifdef HAVE_MSC_ATOMICS
|
||||
SDL_COMPILE_TIME_ASSERT(atomic_cas, sizeof(long) == sizeof(a->value));
|
||||
@@ -183,7 +183,7 @@ SDL_AtomicCASPtr(void **a, void *oldval, void *newval)
|
||||
#endif
|
||||
}
|
||||
|
||||
int SDL_AtomicSet(SDL_atomic_t *a, int v)
|
||||
int SDL_AtomicSet(SDL_AtomicInt *a, int v)
|
||||
{
|
||||
#ifdef HAVE_MSC_ATOMICS
|
||||
SDL_COMPILE_TIME_ASSERT(atomic_set, sizeof(long) == sizeof(a->value));
|
||||
@@ -223,7 +223,7 @@ SDL_AtomicSetPtr(void **a, void *v)
|
||||
#endif
|
||||
}
|
||||
|
||||
int SDL_AtomicAdd(SDL_atomic_t *a, int v)
|
||||
int SDL_AtomicAdd(SDL_AtomicInt *a, int v)
|
||||
{
|
||||
#ifdef HAVE_MSC_ATOMICS
|
||||
SDL_COMPILE_TIME_ASSERT(atomic_add, sizeof(long) == sizeof(a->value));
|
||||
@@ -246,7 +246,7 @@ int SDL_AtomicAdd(SDL_atomic_t *a, int v)
|
||||
#endif
|
||||
}
|
||||
|
||||
int SDL_AtomicGet(SDL_atomic_t *a)
|
||||
int SDL_AtomicGet(SDL_AtomicInt *a)
|
||||
{
|
||||
#ifdef HAVE_ATOMIC_LOAD_N
|
||||
return __atomic_load_n(&a->value, __ATOMIC_SEQ_CST);
|
||||
|
||||
@@ -138,9 +138,9 @@ struct SDL_AudioDevice
|
||||
SDL_AudioStream *stream;
|
||||
|
||||
/* Current state flags */
|
||||
SDL_atomic_t shutdown; /* true if we are signaling the play thread to end. */
|
||||
SDL_atomic_t enabled; /* true if device is functioning and connected. */
|
||||
SDL_atomic_t paused;
|
||||
SDL_AtomicInt shutdown; /* true if we are signaling the play thread to end. */
|
||||
SDL_AtomicInt enabled; /* true if device is functioning and connected. */
|
||||
SDL_AtomicInt paused;
|
||||
SDL_bool iscapture;
|
||||
|
||||
/* Scratch buffer used in the bridge between SDL and the user callback. */
|
||||
|
||||
@@ -894,7 +894,7 @@ static void ALSA_HotplugIteration(void)
|
||||
}
|
||||
|
||||
#if SDL_ALSA_HOTPLUG_THREAD
|
||||
static SDL_atomic_t ALSA_hotplug_shutdown;
|
||||
static SDL_AtomicInt ALSA_hotplug_shutdown;
|
||||
static SDL_Thread *ALSA_hotplug_thread;
|
||||
|
||||
static int SDLCALL ALSA_HotplugThread(void *arg)
|
||||
|
||||
@@ -64,7 +64,7 @@ struct SDL_PrivateAudioData
|
||||
char *thread_error;
|
||||
#if MACOSX_COREAUDIO
|
||||
AudioDeviceID deviceID;
|
||||
SDL_atomic_t device_change_flag;
|
||||
SDL_AtomicInt device_change_flag;
|
||||
#else
|
||||
SDL_bool interrupted;
|
||||
CFTypeRef interruption_listener;
|
||||
|
||||
@@ -38,7 +38,7 @@ extern "C" {
|
||||
|
||||
struct SDL_PrivateAudioData
|
||||
{
|
||||
SDL_atomic_t refcount;
|
||||
SDL_AtomicInt refcount;
|
||||
WCHAR *devid;
|
||||
WAVEFORMATEX *waveformat;
|
||||
IAudioClient *client;
|
||||
@@ -52,7 +52,7 @@ struct SDL_PrivateAudioData
|
||||
int default_device_generation;
|
||||
SDL_bool device_lost;
|
||||
void *activation_handler;
|
||||
SDL_atomic_t just_activated;
|
||||
SDL_AtomicInt just_activated;
|
||||
};
|
||||
|
||||
/* win32 and winrt implementations call into these. */
|
||||
|
||||
@@ -56,8 +56,8 @@ static Platform::String ^ SDL_PKEY_AudioEngine_DeviceFormat = L"{f19f064d-082c-4
|
||||
static void WASAPI_AddDevice(const SDL_bool iscapture, const char *devname, WAVEFORMATEXTENSIBLE *fmt, LPCWSTR devid);
|
||||
static void WASAPI_RemoveDevice(const SDL_bool iscapture, LPCWSTR devid);
|
||||
extern "C" {
|
||||
SDL_atomic_t SDL_IMMDevice_DefaultPlaybackGeneration;
|
||||
SDL_atomic_t SDL_IMMDevice_DefaultCaptureGeneration;
|
||||
SDL_AtomicInt SDL_IMMDevice_DefaultPlaybackGeneration;
|
||||
SDL_AtomicInt SDL_IMMDevice_DefaultCaptureGeneration;
|
||||
}
|
||||
|
||||
/* This is a list of device id strings we have inflight, so we have consistent pointers to the same device. */
|
||||
|
||||
@@ -366,7 +366,7 @@ static SDL_bool bHasNewData;
|
||||
|
||||
static SDL_bool bHasEnvironmentVariables;
|
||||
|
||||
static SDL_atomic_t bPermissionRequestPending;
|
||||
static SDL_AtomicInt bPermissionRequestPending;
|
||||
static SDL_bool bPermissionRequestResult;
|
||||
|
||||
/* Android AssetManager */
|
||||
@@ -1359,7 +1359,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)(
|
||||
Functions called by SDL into Java
|
||||
*******************************************************************************/
|
||||
|
||||
static SDL_atomic_t s_active;
|
||||
static SDL_AtomicInt s_active;
|
||||
struct LocalReferenceHolder
|
||||
{
|
||||
JNIEnv *m_env;
|
||||
|
||||
@@ -52,8 +52,8 @@ static const GUID SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = { 0x00000003, 0x0000, 0x
|
||||
/* *INDENT-ON* */ /* clang-format on */
|
||||
|
||||
/* these increment as default devices change. Opened default devices pick up changes in their threads. */
|
||||
SDL_atomic_t SDL_IMMDevice_DefaultPlaybackGeneration;
|
||||
SDL_atomic_t SDL_IMMDevice_DefaultCaptureGeneration;
|
||||
SDL_AtomicInt SDL_IMMDevice_DefaultPlaybackGeneration;
|
||||
SDL_AtomicInt SDL_IMMDevice_DefaultCaptureGeneration;
|
||||
|
||||
static void GetMMDeviceInfo(IMMDevice *device, char **utf8dev, WAVEFORMATEXTENSIBLE *fmt, GUID *guid)
|
||||
{
|
||||
@@ -180,7 +180,7 @@ static void SDL_IMMDevice_Add(const SDL_bool iscapture, const char *devname, WAV
|
||||
typedef struct SDLMMNotificationClient
|
||||
{
|
||||
const IMMNotificationClientVtbl *lpVtbl;
|
||||
SDL_atomic_t refcount;
|
||||
SDL_AtomicInt refcount;
|
||||
SDL_bool useguid;
|
||||
} SDLMMNotificationClient;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ int SDL_IMMDevice_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int isca
|
||||
SDL_AudioFormat WaveFormatToSDLFormat(WAVEFORMATEX *waveformat);
|
||||
|
||||
/* these increment as default devices change. Opened default devices pick up changes in their threads. */
|
||||
extern SDL_atomic_t SDL_IMMDevice_DefaultPlaybackGeneration;
|
||||
extern SDL_atomic_t SDL_IMMDevice_DefaultCaptureGeneration;
|
||||
extern SDL_AtomicInt SDL_IMMDevice_DefaultPlaybackGeneration;
|
||||
extern SDL_AtomicInt SDL_IMMDevice_DefaultCaptureGeneration;
|
||||
|
||||
#endif /* SDL_IMMDEVICE_H */
|
||||
|
||||
@@ -122,13 +122,13 @@ SDL_DYNAPI_PROC(int,SDL_AddGamepadMappingsFromRW,(SDL_RWops *a, int b),(a,b),ret
|
||||
SDL_DYNAPI_PROC(int,SDL_AddHintCallback,(const char *a, SDL_HintCallback b, void *c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(SDL_TimerID,SDL_AddTimer,(Uint32 a, SDL_TimerCallback b, void *c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(SDL_RWops*,SDL_CreateRW,(void),(),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_AtomicAdd,(SDL_atomic_t *a, int b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_AtomicCAS,(SDL_atomic_t *a, int b, int c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_AtomicAdd,(SDL_AtomicInt *a, int b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_AtomicCAS,(SDL_AtomicInt *a, int b, int c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_AtomicCASPtr,(void **a, void *b, void *c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_AtomicGet,(SDL_atomic_t *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_AtomicGet,(SDL_AtomicInt *a),(a),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_AtomicGetPtr,(void **a),(a),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_AtomicLock,(SDL_SpinLock *a),(a),)
|
||||
SDL_DYNAPI_PROC(int,SDL_AtomicSet,(SDL_atomic_t *a, int b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_AtomicSet,(SDL_AtomicInt *a, int b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_AtomicSetPtr,(void **a, void *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_AtomicTryLock,(SDL_SpinLock *a),(a),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_AtomicUnlock,(SDL_SpinLock *a),(a),)
|
||||
|
||||
@@ -60,7 +60,7 @@ static SDL_EventWatcher *SDL_event_watchers = NULL;
|
||||
static int SDL_event_watchers_count = 0;
|
||||
static SDL_bool SDL_event_watchers_dispatching = SDL_FALSE;
|
||||
static SDL_bool SDL_event_watchers_removed = SDL_FALSE;
|
||||
static SDL_atomic_t SDL_sentinel_pending;
|
||||
static SDL_AtomicInt SDL_sentinel_pending;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -89,7 +89,7 @@ static struct
|
||||
{
|
||||
SDL_mutex *lock;
|
||||
SDL_bool active;
|
||||
SDL_atomic_t count;
|
||||
SDL_AtomicInt count;
|
||||
int max_events_seen;
|
||||
SDL_EventEntry *head;
|
||||
SDL_EventEntry *tail;
|
||||
|
||||
@@ -47,7 +47,7 @@ struct haptic_hwdata
|
||||
SDL_Thread *thread;
|
||||
SDL_mutex *mutex;
|
||||
Uint64 stopTicks;
|
||||
SDL_atomic_t stopThread;
|
||||
SDL_AtomicInt stopThread;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -113,7 +113,7 @@ static int SDL_joysticks_locked;
|
||||
static SDL_bool SDL_joysticks_initialized;
|
||||
static SDL_bool SDL_joysticks_quitting = SDL_FALSE;
|
||||
static SDL_Joystick *SDL_joysticks SDL_GUARDED_BY(SDL_joystick_lock) = NULL;
|
||||
static SDL_atomic_t SDL_last_joystick_instance_id SDL_GUARDED_BY(SDL_joystick_lock);
|
||||
static SDL_AtomicInt SDL_last_joystick_instance_id SDL_GUARDED_BY(SDL_joystick_lock);
|
||||
static int SDL_joystick_player_count SDL_GUARDED_BY(SDL_joystick_lock) = 0;
|
||||
static SDL_JoystickID *SDL_joystick_players SDL_GUARDED_BY(SDL_joystick_lock) = NULL;
|
||||
static SDL_bool SDL_joystick_allows_background_events = SDL_FALSE;
|
||||
|
||||
@@ -41,8 +41,8 @@ typedef struct SDL_HIDAPI_RumbleRequest
|
||||
|
||||
typedef struct SDL_HIDAPI_RumbleContext
|
||||
{
|
||||
SDL_atomic_t initialized;
|
||||
SDL_atomic_t running;
|
||||
SDL_AtomicInt initialized;
|
||||
SDL_AtomicInt running;
|
||||
SDL_Thread *thread;
|
||||
SDL_sem *request_sem;
|
||||
SDL_HIDAPI_RumbleRequest *requests_head;
|
||||
|
||||
@@ -71,7 +71,7 @@ typedef struct SDL_HIDAPI_Device
|
||||
void *context;
|
||||
SDL_mutex *dev_lock;
|
||||
SDL_hid_device *dev;
|
||||
SDL_atomic_t rumble_pending;
|
||||
SDL_AtomicInt rumble_pending;
|
||||
int num_joysticks;
|
||||
SDL_JoystickID *joysticks;
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ static void RAWINPUT_JoystickClose(SDL_Joystick *joystick);
|
||||
|
||||
typedef struct SDL_RAWINPUT_Device
|
||||
{
|
||||
SDL_atomic_t refcount;
|
||||
SDL_AtomicInt refcount;
|
||||
char *name;
|
||||
char *path;
|
||||
Uint16 vendor_id;
|
||||
|
||||
@@ -208,7 +208,7 @@ static SDL_bool SDL_IsXInputDevice(Uint16 vendor, Uint16 product)
|
||||
typedef struct RawGameControllerDelegate
|
||||
{
|
||||
__FIEventHandler_1_Windows__CGaming__CInput__CRawGameController iface;
|
||||
SDL_atomic_t refcount;
|
||||
SDL_AtomicInt refcount;
|
||||
} RawGameControllerDelegate;
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_QueryInterface(__FIEventHandler_1_Windows__CGaming__CInput__CRawGameController *This, REFIID riid, void **ppvObject)
|
||||
|
||||
@@ -50,7 +50,7 @@ static SDL_SensorDriver *SDL_sensor_drivers[] = {
|
||||
};
|
||||
static SDL_mutex *SDL_sensor_lock = NULL; /* This needs to support recursive locks */
|
||||
static SDL_Sensor *SDL_sensors SDL_GUARDED_BY(SDL_sensor_lock) = NULL;
|
||||
static SDL_atomic_t SDL_last_sensor_instance_id SDL_GUARDED_BY(SDL_sensor_lock);
|
||||
static SDL_AtomicInt SDL_last_sensor_instance_id SDL_GUARDED_BY(SDL_sensor_lock);
|
||||
|
||||
void SDL_LockSensors(void) SDL_ACQUIRE(SDL_sensor_lock)
|
||||
{
|
||||
|
||||
@@ -5203,7 +5203,7 @@ static struct
|
||||
SDL_calloc_func calloc_func;
|
||||
SDL_realloc_func realloc_func;
|
||||
SDL_free_func free_func;
|
||||
SDL_atomic_t num_allocations;
|
||||
SDL_AtomicInt num_allocations;
|
||||
} s_mem = {
|
||||
real_malloc, real_calloc, real_realloc, real_free, { 0 }
|
||||
};
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
SDL_TLSID
|
||||
SDL_TLSCreate(void)
|
||||
{
|
||||
static SDL_atomic_t SDL_tls_id;
|
||||
static SDL_AtomicInt SDL_tls_id;
|
||||
return SDL_AtomicIncRef(&SDL_tls_id) + 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ struct SDL_Thread
|
||||
SDL_threadID threadid;
|
||||
SYS_ThreadHandle handle;
|
||||
int status;
|
||||
SDL_atomic_t state; /* SDL_THREAD_STATE_* */
|
||||
SDL_AtomicInt state; /* SDL_THREAD_STATE_* */
|
||||
SDL_error errbuf;
|
||||
char *name;
|
||||
size_t stacksize; /* 0 for default, >0 for user-specified stack size. */
|
||||
|
||||
@@ -34,7 +34,7 @@ typedef struct SDL_Timer
|
||||
void *param;
|
||||
Uint64 interval;
|
||||
Uint64 scheduled;
|
||||
SDL_atomic_t canceled;
|
||||
SDL_AtomicInt canceled;
|
||||
struct SDL_Timer *next;
|
||||
} SDL_Timer;
|
||||
|
||||
@@ -50,7 +50,7 @@ typedef struct
|
||||
{
|
||||
/* Data used by the main thread */
|
||||
SDL_Thread *thread;
|
||||
SDL_atomic_t nextID;
|
||||
SDL_AtomicInt nextID;
|
||||
SDL_TimerMap *timermap;
|
||||
SDL_mutex *timermap_lock;
|
||||
|
||||
@@ -62,7 +62,7 @@ typedef struct
|
||||
SDL_sem *sem;
|
||||
SDL_Timer *pending;
|
||||
SDL_Timer *freelist;
|
||||
SDL_atomic_t active;
|
||||
SDL_AtomicInt active;
|
||||
|
||||
/* List of timers - this is only touched by the timer thread */
|
||||
SDL_Timer *timers;
|
||||
|
||||
@@ -310,7 +310,7 @@ static int SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window, U
|
||||
}
|
||||
|
||||
static SDL_VideoDevice *_this = NULL;
|
||||
static SDL_atomic_t SDL_messagebox_count;
|
||||
static SDL_AtomicInt SDL_messagebox_count;
|
||||
|
||||
static int SDL_UpdateWindowTexture(SDL_VideoDevice *unused, SDL_Window *window, const SDL_Rect *rects, int numrects)
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ struct SDL_GLDriverData
|
||||
|
||||
@interface SDLOpenGLContext : NSOpenGLContext
|
||||
{
|
||||
SDL_atomic_t dirty;
|
||||
SDL_AtomicInt dirty;
|
||||
SDL_Window *window;
|
||||
CVDisplayLinkRef displayLink;
|
||||
@public
|
||||
@@ -49,9 +49,9 @@ struct SDL_GLDriverData
|
||||
@public
|
||||
SDL_cond *swapIntervalCond;
|
||||
@public
|
||||
SDL_atomic_t swapIntervalSetting;
|
||||
SDL_AtomicInt swapIntervalSetting;
|
||||
@public
|
||||
SDL_atomic_t swapIntervalsPassed;
|
||||
SDL_AtomicInt swapIntervalsPassed;
|
||||
}
|
||||
|
||||
- (id)initWithFormat:(NSOpenGLPixelFormat *)format
|
||||
|
||||
@@ -94,7 +94,7 @@ struct SDL_WindowData
|
||||
/* floating dimensions for restoring from maximized and fullscreen */
|
||||
int floating_width, floating_height;
|
||||
|
||||
SDL_atomic_t swap_interval_ready;
|
||||
SDL_AtomicInt swap_interval_ready;
|
||||
|
||||
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
|
||||
struct qt_extended_surface *extended_surface;
|
||||
|
||||
Reference in New Issue
Block a user