mirror of https://github.com/libsdl-org/SDL
Renamed SDL_AtomicSetPtr() and SDL_AtomicGetPtr()
Fixes https://github.com/libsdl-org/SDL/issues/10601
This commit is contained in:
parent
00708b976a
commit
cf1d8e2dfd
|
@ -3623,3 +3623,13 @@ identifier func =~ "^(SDL_AddEventWatch|SDL_AddHintCallback|SDL_AddSurfaceAltern
|
|||
)
|
||||
- == -1
|
||||
)
|
||||
@@
|
||||
@@
|
||||
- SDL_AtomicSetPtr
|
||||
+ SDL_AtomicSetPointer
|
||||
(...)
|
||||
@@
|
||||
@@
|
||||
- SDL_AtomicGetPtr
|
||||
+ SDL_AtomicGetPointer
|
||||
(...)
|
||||
|
|
|
@ -88,7 +88,9 @@ The following structures have been renamed:
|
|||
The following functions have been renamed:
|
||||
* SDL_AtomicCAS() => SDL_AtomicCompareAndSwap()
|
||||
* SDL_AtomicCASPtr() => SDL_AtomicCompareAndSwapPointer()
|
||||
* SDL_AtomicGetPtr() => SDL_AtomicGetPointer()
|
||||
* SDL_AtomicLock() => SDL_LockSpinlock()
|
||||
* SDL_AtomicSetPtr() => SDL_AtomicSetPointer()
|
||||
* SDL_AtomicTryLock() => SDL_TryLockSpinlock()
|
||||
* SDL_AtomicUnlock() => SDL_UnlockSpinlock()
|
||||
|
||||
|
|
|
@ -455,8 +455,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_AtomicInt *a, int v);
|
|||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_AtomicCompareAndSwap
|
||||
* \sa SDL_AtomicGetPtr
|
||||
* \sa SDL_AtomicSetPtr
|
||||
* \sa SDL_AtomicGetPointer
|
||||
* \sa SDL_AtomicSetPointer
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareAndSwapPointer(void **a, void *oldval, void *newval);
|
||||
|
||||
|
@ -475,9 +475,9 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareAndSwapPointer(void **a, v
|
|||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_AtomicCompareAndSwapPointer
|
||||
* \sa SDL_AtomicGetPtr
|
||||
* \sa SDL_AtomicGetPointer
|
||||
*/
|
||||
extern SDL_DECLSPEC void * SDLCALL SDL_AtomicSetPtr(void **a, void *v);
|
||||
extern SDL_DECLSPEC void * SDLCALL SDL_AtomicSetPointer(void **a, void *v);
|
||||
|
||||
/**
|
||||
* Get the value of a pointer atomically.
|
||||
|
@ -493,9 +493,9 @@ extern SDL_DECLSPEC void * SDLCALL SDL_AtomicSetPtr(void **a, void *v);
|
|||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_AtomicCompareAndSwapPointer
|
||||
* \sa SDL_AtomicSetPtr
|
||||
* \sa SDL_AtomicSetPointer
|
||||
*/
|
||||
extern SDL_DECLSPEC void * SDLCALL SDL_AtomicGetPtr(void **a);
|
||||
extern SDL_DECLSPEC void * SDLCALL SDL_AtomicGetPointer(void **a);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -40,7 +40,9 @@
|
|||
/* ##SDL_atomic.h */
|
||||
#define SDL_AtomicCAS SDL_AtomicCompareAndSwap
|
||||
#define SDL_AtomicCASPtr SDL_AtomicCompareAndSwapPointer
|
||||
#define SDL_AtomicGetPtr SDL_AtomicGetPointer
|
||||
#define SDL_AtomicLock SDL_LockSpinlock
|
||||
#define SDL_AtomicSetPtr SDL_AtomicSetPointer
|
||||
#define SDL_AtomicTryLock SDL_TryLockSpinlock
|
||||
#define SDL_AtomicUnlock SDL_UnlockSpinlock
|
||||
#define SDL_atomic_t SDL_AtomicInt
|
||||
|
@ -659,7 +661,9 @@
|
|||
/* ##SDL_atomic.h */
|
||||
#define SDL_AtomicCAS SDL_AtomicCAS_renamed_SDL_AtomicCompareAndSwap
|
||||
#define SDL_AtomicCASPtr SDL_AtomicCASPtr_renamed_SDL_AtomicCompareAndSwapPointer
|
||||
#define SDL_AtomicGetPtr SDL_AtomicGetPtr_renamed_SDL_AtomicGetPointer
|
||||
#define SDL_AtomicLock SDL_AtomicLock_renamed_SDL_LockSpinlock
|
||||
#define SDL_AtomicSetPtr SDL_AtomicSetPtr_renamed_SDL_AtomicSetPointer
|
||||
#define SDL_AtomicTryLock SDL_AtomicTryLock_renamed_SDL_TryLockSpinlock
|
||||
#define SDL_AtomicUnlock SDL_AtomicUnlock_renamed_SDL_UnlockSpinlock
|
||||
#define SDL_atomic_t SDL_atomic_t_renamed_SDL_AtomicInt
|
||||
|
|
|
@ -201,7 +201,7 @@ int SDL_AtomicSet(SDL_AtomicInt *a, int v)
|
|||
#endif
|
||||
}
|
||||
|
||||
void *SDL_AtomicSetPtr(void **a, void *v)
|
||||
void *SDL_AtomicSetPointer(void **a, void *v)
|
||||
{
|
||||
#ifdef HAVE_MSC_ATOMICS
|
||||
return _InterlockedExchangePointer(a, v);
|
||||
|
@ -267,7 +267,7 @@ int SDL_AtomicGet(SDL_AtomicInt *a)
|
|||
#endif
|
||||
}
|
||||
|
||||
void *SDL_AtomicGetPtr(void **a)
|
||||
void *SDL_AtomicGetPointer(void **a)
|
||||
{
|
||||
#ifdef HAVE_ATOMIC_LOAD_N
|
||||
return __atomic_load_n(a, __ATOMIC_SEQ_CST);
|
||||
|
|
|
@ -390,7 +390,7 @@ static SDL_LogicalAudioDevice *ObtainLogicalAudioDevice(SDL_AudioDeviceID devid,
|
|||
// to make sure the correct physical device gets locked, in case we're in a race with the default changing.
|
||||
while (true) {
|
||||
SDL_LockMutex(device->lock);
|
||||
SDL_AudioDevice *recheck_device = (SDL_AudioDevice *) SDL_AtomicGetPtr((void **) &logdev->physical_device);
|
||||
SDL_AudioDevice *recheck_device = (SDL_AudioDevice *) SDL_AtomicGetPointer((void **) &logdev->physical_device);
|
||||
if (device == recheck_device) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -74,11 +74,11 @@ static void ManagementThreadMainloop(void)
|
|||
{
|
||||
SDL_LockMutex(ManagementThreadLock);
|
||||
ManagementThreadPendingTask *task;
|
||||
while (((task = (ManagementThreadPendingTask *)SDL_AtomicGetPtr((void **)&ManagementThreadPendingTasks)) != NULL) || !SDL_AtomicGet(&ManagementThreadShutdown)) {
|
||||
while (((task = (ManagementThreadPendingTask *)SDL_AtomicGetPointer((void **)&ManagementThreadPendingTasks)) != NULL) || !SDL_AtomicGet(&ManagementThreadShutdown)) {
|
||||
if (!task) {
|
||||
SDL_WaitCondition(ManagementThreadCondition, ManagementThreadLock); // block until there's something to do.
|
||||
} else {
|
||||
SDL_AtomicSetPtr((void **) &ManagementThreadPendingTasks, task->next); // take task off the pending list.
|
||||
SDL_AtomicSetPointer((void **) &ManagementThreadPendingTasks, task->next); // take task off the pending list.
|
||||
SDL_UnlockMutex(ManagementThreadLock); // let other things add to the list while we chew on this task.
|
||||
task->result = task->fn(task->userdata); // run this task.
|
||||
if (task->task_complete_sem) { // something waiting on result?
|
||||
|
@ -127,14 +127,14 @@ bool WASAPI_ProxyToManagementThread(ManagementThreadTask task, void *userdata, b
|
|||
|
||||
// add to end of task list.
|
||||
ManagementThreadPendingTask *prev = NULL;
|
||||
for (ManagementThreadPendingTask *i = (ManagementThreadPendingTask *)SDL_AtomicGetPtr((void **)&ManagementThreadPendingTasks); i; i = i->next) {
|
||||
for (ManagementThreadPendingTask *i = (ManagementThreadPendingTask *)SDL_AtomicGetPointer((void **)&ManagementThreadPendingTasks); i; i = i->next) {
|
||||
prev = i;
|
||||
}
|
||||
|
||||
if (prev) {
|
||||
prev->next = pending;
|
||||
} else {
|
||||
SDL_AtomicSetPtr((void **) &ManagementThreadPendingTasks, pending);
|
||||
SDL_AtomicSetPointer((void **) &ManagementThreadPendingTasks, pending);
|
||||
}
|
||||
|
||||
// task is added to the end of the pending list, let management thread rip!
|
||||
|
@ -210,7 +210,7 @@ static bool InitManagementThread(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
SDL_AtomicSetPtr((void **) &ManagementThreadPendingTasks, NULL);
|
||||
SDL_AtomicSetPointer((void **) &ManagementThreadPendingTasks, NULL);
|
||||
SDL_AtomicSet(&ManagementThreadShutdown, 0);
|
||||
ManagementThread = SDL_CreateThreadWithStackSize(ManagementThreadEntry, "SDLWASAPIMgmt", 256 * 1024, &mgmtdata); // !!! FIXME: maybe even smaller stack size?
|
||||
if (!ManagementThread) {
|
||||
|
@ -242,7 +242,7 @@ static void DeinitManagementThread(void)
|
|||
ManagementThread = NULL;
|
||||
}
|
||||
|
||||
SDL_assert(SDL_AtomicGetPtr((void **) &ManagementThreadPendingTasks) == NULL);
|
||||
SDL_assert(SDL_AtomicGetPointer((void **) &ManagementThreadPendingTasks) == NULL);
|
||||
|
||||
SDL_DestroyCondition(ManagementThreadCondition);
|
||||
SDL_DestroyMutex(ManagementThreadLock);
|
||||
|
|
|
@ -18,9 +18,9 @@ SDL3_0.0.0 {
|
|||
SDL_AtomicCompareAndSwap;
|
||||
SDL_AtomicCompareAndSwapPointer;
|
||||
SDL_AtomicGet;
|
||||
SDL_AtomicGetPtr;
|
||||
SDL_AtomicGetPointer;
|
||||
SDL_AtomicSet;
|
||||
SDL_AtomicSetPtr;
|
||||
SDL_AtomicSetPointer;
|
||||
SDL_AttachVirtualJoystick;
|
||||
SDL_AudioDevicePaused;
|
||||
SDL_BeginGPUComputePass;
|
||||
|
|
|
@ -43,9 +43,9 @@
|
|||
#define SDL_AtomicCompareAndSwap SDL_AtomicCompareAndSwap_REAL
|
||||
#define SDL_AtomicCompareAndSwapPointer SDL_AtomicCompareAndSwapPointer_REAL
|
||||
#define SDL_AtomicGet SDL_AtomicGet_REAL
|
||||
#define SDL_AtomicGetPtr SDL_AtomicGetPtr_REAL
|
||||
#define SDL_AtomicGetPointer SDL_AtomicGetPointer_REAL
|
||||
#define SDL_AtomicSet SDL_AtomicSet_REAL
|
||||
#define SDL_AtomicSetPtr SDL_AtomicSetPtr_REAL
|
||||
#define SDL_AtomicSetPointer SDL_AtomicSetPointer_REAL
|
||||
#define SDL_AttachVirtualJoystick SDL_AttachVirtualJoystick_REAL
|
||||
#define SDL_AudioDevicePaused SDL_AudioDevicePaused_REAL
|
||||
#define SDL_BeginGPUComputePass SDL_BeginGPUComputePass_REAL
|
||||
|
|
|
@ -63,9 +63,9 @@ SDL_DYNAPI_PROC(int,SDL_AtomicAdd,(SDL_AtomicInt *a, int b),(a,b),return)
|
|||
SDL_DYNAPI_PROC(SDL_bool,SDL_AtomicCompareAndSwap,(SDL_AtomicInt *a, int b, int c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_AtomicCompareAndSwapPointer,(void **a, void *b, void *c),(a,b,c),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_AtomicGetPointer,(void **a),(a),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(void*,SDL_AtomicSetPointer,(void **a, void *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_JoystickID,SDL_AttachVirtualJoystick,(const SDL_VirtualJoystickDesc *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_AudioDevicePaused,(SDL_AudioDeviceID a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_GPUComputePass*,SDL_BeginGPUComputePass,(SDL_GPUCommandBuffer *a, SDL_GPUStorageTextureWriteOnlyBinding *b, Uint32 c, SDL_GPUStorageBufferWriteOnlyBinding *d, Uint32 e),(a,b,c,d,e),return)
|
||||
|
|
Loading…
Reference in New Issue