From 87ad71f9b2cacf57bf65d8b62546dc2dcd841352 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 28 Apr 2023 07:31:12 -0700
Subject: [PATCH] Rename SDL mutex, semaphore and condition variable types to
match SDL 3.0 naming convention
---
build-scripts/SDL_migration.cocci | 15 +++++
docs/README-migration.md | 5 ++
include/SDL3/SDL_joystick.h | 2 +-
include/SDL3/SDL_mutex.h | 68 +++++++++++-----------
include/SDL3/SDL_oldnames.h | 10 ++++
src/SDL_assert.c | 2 +-
src/SDL_dataqueue.c | 4 +-
src/SDL_dataqueue.h | 2 +-
src/SDL_internal.h | 4 +-
src/SDL_log.c | 2 +-
src/atomic/SDL_spinlock.c | 2 +-
src/audio/SDL_audiocvt.c | 2 +-
src/audio/SDL_sysaudio.h | 4 +-
src/audio/coreaudio/SDL_coreaudio.h | 2 +-
src/audio/jack/SDL_jackaudio.h | 2 +-
src/audio/openslES/SDL_openslES.h | 2 +-
src/audio/wasapi/SDL_wasapi_winrt.cpp | 2 +-
src/dynapi/SDL_dynapi_procs.h | 50 ++++++++--------
src/events/SDL_events.c | 4 +-
src/haptic/windows/SDL_windowshaptic_c.h | 2 +-
src/hidapi/libusb/hid.c | 8 +--
src/joystick/SDL_joystick.c | 2 +-
src/joystick/hidapi/SDL_hidapi_rumble.c | 4 +-
src/joystick/hidapi/SDL_hidapi_rumble.h | 2 +-
src/joystick/hidapi/SDL_hidapijoystick_c.h | 2 +-
src/joystick/windows/SDL_windowsjoystick.c | 6 +-
src/render/SDL_sysrender.h | 2 +-
src/sensor/SDL_sensor.c | 2 +-
src/thread/SDL_thread.c | 14 ++---
src/thread/generic/SDL_syscond.c | 20 +++----
src/thread/generic/SDL_syscond_c.h | 10 ++--
src/thread/generic/SDL_sysmutex.c | 18 +++---
src/thread/generic/SDL_sysrwlock.c | 22 +++----
src/thread/generic/SDL_sysrwlock_c.h | 14 ++---
src/thread/generic/SDL_syssem.c | 32 +++++-----
src/thread/n3ds/SDL_syscond.c | 14 ++---
src/thread/n3ds/SDL_sysmutex.c | 14 ++---
src/thread/n3ds/SDL_sysmutex_c.h | 2 +-
src/thread/n3ds/SDL_syssem.c | 20 +++----
src/thread/ngage/SDL_sysmutex.cpp | 14 ++---
src/thread/ngage/SDL_syssem.cpp | 16 ++---
src/thread/ps2/SDL_syssem.c | 16 ++---
src/thread/psp/SDL_syscond.c | 22 +++----
src/thread/psp/SDL_sysmutex.c | 16 ++---
src/thread/psp/SDL_syssem.c | 16 ++---
src/thread/pthread/SDL_syscond.c | 16 ++---
src/thread/pthread/SDL_sysmutex.c | 14 ++---
src/thread/pthread/SDL_sysmutex_c.h | 2 +-
src/thread/pthread/SDL_sysrwlock.c | 20 +++----
src/thread/pthread/SDL_syssem.c | 14 ++---
src/thread/stdcpp/SDL_syscond.cpp | 14 ++---
src/thread/stdcpp/SDL_sysmutex.cpp | 12 ++--
src/thread/stdcpp/SDL_sysmutex_c.h | 2 +-
src/thread/stdcpp/SDL_sysrwlock.cpp | 18 +++---
src/thread/vita/SDL_syscond.c | 22 +++----
src/thread/vita/SDL_sysmutex.c | 16 ++---
src/thread/vita/SDL_syssem.c | 16 ++---
src/thread/windows/SDL_syscond_cv.c | 36 ++++++------
src/thread/windows/SDL_sysmutex.c | 34 +++++------
src/thread/windows/SDL_sysmutex_c.h | 12 ++--
src/thread/windows/SDL_sysrwlock_srw.c | 46 +++++++--------
src/thread/windows/SDL_syssem.c | 44 +++++++-------
src/timer/SDL_timer.c | 4 +-
src/video/SDL_sysvideo.h | 2 +-
src/video/android/SDL_androidvideo.c | 6 +-
src/video/android/SDL_androidvideo.h | 4 +-
src/video/cocoa/SDL_cocoaopengl.h | 4 +-
src/video/cocoa/SDL_cocoavideo.h | 2 +-
src/video/psp/SDL_pspevents.c | 2 +-
src/video/raspberry/SDL_rpivideo.h | 4 +-
src/video/winrt/SDL_winrtevents.cpp | 4 +-
test/testatomic.c | 4 +-
test/testlock.c | 2 +-
test/testrwlock.c | 2 +-
test/testsem.c | 2 +-
75 files changed, 452 insertions(+), 422 deletions(-)
diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci
index 2f0469418c20..da0987b1d5eb 100644
--- a/build-scripts/SDL_migration.cocci
+++ b/build-scripts/SDL_migration.cocci
@@ -2593,3 +2593,18 @@ typedef SDL_atomic_t, SDL_AtomicInt;
- SDL_CondWaitTimeout
+ SDL_WaitConditionTimeout
(...)
+@@
+typedef SDL_mutex, SDL_Mutex;
+@@
+- SDL_mutex
++ SDL_Mutex
+@@
+typedef SDL_sem, SDL_Semaphore;
+@@
+- SDL_sem
++ SDL_Semaphore
+@@
+typedef SDL_cond, SDL_Condition;
+@@
+- SDL_cond
++ SDL_Condition
diff --git a/docs/README-migration.md b/docs/README-migration.md
index 25d762ffba5c..4448f6f1e409 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -569,6 +569,11 @@ The following functions have been renamed:
* SDL_SemWait() => SDL_WaitSemaphore()
* SDL_SemWaitTimeout() => SDL_WaitSemaphoreTimeout()
+The following symbols have been renamed:
+* SDL_cond => SDL_Condition
+* SDL_mutex => SDL_Mutex
+* SDL_sem => SDL_Semaphore
+
## SDL_pixels.h
SDL_CalculateGammaRamp has been removed, because SDL_SetWindowGammaRamp has been removed as well due to poor support in modern operating systems (see [SDL_video.h](#sdl_videoh)).
diff --git a/include/SDL3/SDL_joystick.h b/include/SDL3/SDL_joystick.h
index 92da0ce894ed..c7985a92b2c5 100644
--- a/include/SDL3/SDL_joystick.h
+++ b/include/SDL3/SDL_joystick.h
@@ -65,7 +65,7 @@ extern "C" {
* The joystick structure used to identify an SDL joystick
*/
#ifdef SDL_THREAD_SAFETY_ANALYSIS
-extern SDL_mutex *SDL_joystick_lock;
+extern SDL_Mutex *SDL_joystick_lock;
#endif
struct SDL_Joystick;
typedef struct SDL_Joystick SDL_Joystick;
diff --git a/include/SDL3/SDL_mutex.h b/include/SDL3/SDL_mutex.h
index 67741abc314d..621a0981508d 100644
--- a/include/SDL3/SDL_mutex.h
+++ b/include/SDL3/SDL_mutex.h
@@ -129,8 +129,8 @@ extern "C" {
/* @{ */
/* The SDL mutex structure, defined in SDL_sysmutex.c */
-struct SDL_mutex;
-typedef struct SDL_mutex SDL_mutex;
+struct SDL_Mutex;
+typedef struct SDL_Mutex SDL_Mutex;
/**
* Create a new mutex.
@@ -152,7 +152,7 @@ typedef struct SDL_mutex SDL_mutex;
* \sa SDL_TryLockMutex
* \sa SDL_UnlockMutex
*/
-extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void);
+extern DECLSPEC SDL_Mutex *SDLCALL SDL_CreateMutex(void);
/**
* Lock the mutex.
@@ -171,7 +171,7 @@ extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void);
*
* \since This function is available since SDL 3.0.0.
*/
-extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex) SDL_ACQUIRE(mutex);
+extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_Mutex *mutex) SDL_ACQUIRE(mutex);
/**
* Try to lock a mutex without blocking.
@@ -193,7 +193,7 @@ extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex) SDL_ACQUIRE(mutex);
* \sa SDL_LockMutex
* \sa SDL_UnlockMutex
*/
-extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex) SDL_TRY_ACQUIRE(0, mutex);
+extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_Mutex *mutex) SDL_TRY_ACQUIRE(0, mutex);
/**
* Unlock the mutex.
@@ -211,7 +211,7 @@ extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex) SDL_TRY_ACQUIRE(
*
* \since This function is available since SDL 3.0.0.
*/
-extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex) SDL_RELEASE(mutex);
+extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_Mutex *mutex) SDL_RELEASE(mutex);
/**
* Destroy a mutex created with SDL_CreateMutex().
@@ -231,7 +231,7 @@ extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex) SDL_RELEASE(mutex
* \sa SDL_TryLockMutex
* \sa SDL_UnlockMutex
*/
-extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex);
+extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_Mutex *mutex);
/* @} *//* Mutex functions */
@@ -242,8 +242,8 @@ extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex);
/* @{ */
/* The SDL read/write lock structure, defined in SDL_sysrwlock.c */
-struct SDL_rwlock;
-typedef struct SDL_rwlock SDL_rwlock;
+struct SDL_RWLock;
+typedef struct SDL_RWLock SDL_RWLock;
/*
* Synchronization functions which can time out return this value
@@ -292,7 +292,7 @@ typedef struct SDL_rwlock SDL_rwlock;
* \sa SDL_TryLockRWLockForWriting
* \sa SDL_UnlockRWLock
*/
-extern DECLSPEC SDL_rwlock *SDLCALL SDL_CreateRWLock(void);
+extern DECLSPEC SDL_RWLock *SDLCALL SDL_CreateRWLock(void);
/**
* Lock the read/write lock for _read only_ operations.
@@ -325,7 +325,7 @@ extern DECLSPEC SDL_rwlock *SDLCALL SDL_CreateRWLock(void);
*
* \sa SDL_UnlockRWLock
*/
-extern DECLSPEC int SDLCALL SDL_LockRWLockForReading(SDL_rwlock * rwlock) SDL_ACQUIRE_SHARED(rwlock);
+extern DECLSPEC int SDLCALL SDL_LockRWLockForReading(SDL_RWLock *rwlock) SDL_ACQUIRE_SHARED(rwlock);
/**
* Lock the read/write lock for _write_ operations.
@@ -352,7 +352,7 @@ extern DECLSPEC int SDLCALL SDL_LockRWLockForReading(SDL_rwlock * rwlock) SDL_AC
*
* \sa SDL_UnlockRWLock
*/
-extern DECLSPEC int SDLCALL SDL_LockRWLockForWriting(SDL_rwlock * rwlock) SDL_ACQUIRE(rwlock);
+extern DECLSPEC int SDLCALL SDL_LockRWLockForWriting(SDL_RWLock *rwlock) SDL_ACQUIRE(rwlock);
/**
* Try to lock a read/write lock _for reading_ without blocking.
@@ -377,7 +377,7 @@ extern DECLSPEC int SDLCALL SDL_LockRWLockForWriting(SDL_rwlock * rwlock) SDL_AC
* \sa SDL_TryLockRWLockForReading
* \sa SDL_UnlockRWLock
*/
-extern DECLSPEC int SDLCALL SDL_TryLockRWLockForReading(SDL_rwlock * rwlock) SDL_TRY_ACQUIRE_SHARED(0, rwlock);
+extern DECLSPEC int SDLCALL SDL_TryLockRWLockForReading(SDL_RWLock *rwlock) SDL_TRY_ACQUIRE_SHARED(0, rwlock);
/**
* Try to lock a read/write lock _for writing_ without blocking.
@@ -407,7 +407,7 @@ extern DECLSPEC int SDLCALL SDL_TryLockRWLockForReading(SDL_rwlock * rwlock) SDL
* \sa SDL_TryLockRWLockForWriting
* \sa SDL_UnlockRWLock
*/
-extern DECLSPEC int SDLCALL SDL_TryLockRWLockForWriting(SDL_rwlock * rwlock) SDL_TRY_ACQUIRE(0, rwlock);
+extern DECLSPEC int SDLCALL SDL_TryLockRWLockForWriting(SDL_RWLock *rwlock) SDL_TRY_ACQUIRE(0, rwlock);
/**
* Unlock the read/write lock.
@@ -429,7 +429,7 @@ extern DECLSPEC int SDLCALL SDL_TryLockRWLockForWriting(SDL_rwlock * rwlock) SDL
*
* \since This function is available since SDL 3.0.0.
*/
-extern DECLSPEC int SDLCALL SDL_UnlockRWLock(SDL_rwlock * rwlock) SDL_RELEASE_SHARED(rwlock);
+extern DECLSPEC int SDLCALL SDL_UnlockRWLock(SDL_RWLock *rwlock) SDL_RELEASE_SHARED(rwlock);
/**
* Destroy a read/write lock created with SDL_CreateRWLock().
@@ -451,7 +451,7 @@ extern DECLSPEC int SDLCALL SDL_UnlockRWLock(SDL_rwlock * rwlock) SDL_RELEASE_SH
* \sa SDL_TryLockRWLockForWriting
* \sa SDL_UnlockRWLock
*/
-extern DECLSPEC void SDLCALL SDL_DestroyRWLock(SDL_rwlock * rwlock);
+extern DECLSPEC void SDLCALL SDL_DestroyRWLock(SDL_RWLock *rwlock);
/* @} *//* Read/write lock functions */
@@ -462,8 +462,8 @@ extern DECLSPEC void SDLCALL SDL_DestroyRWLock(SDL_rwlock * rwlock);
/* @{ */
/* The SDL semaphore structure, defined in SDL_syssem.c */
-struct SDL_semaphore;
-typedef struct SDL_semaphore SDL_sem;
+struct SDL_Semaphore;
+typedef struct SDL_Semaphore SDL_Semaphore;
/**
* Create a semaphore.
@@ -487,7 +487,7 @@ typedef struct SDL_semaphore SDL_sem;
* \sa SDL_WaitSemaphore
* \sa SDL_WaitSemaphoreTimeout
*/
-extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
+extern DECLSPEC SDL_Semaphore *SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
/**
* Destroy a semaphore.
@@ -506,7 +506,7 @@ extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
* \sa SDL_WaitSemaphore
* \sa SDL_WaitSemaphoreTimeout
*/
-extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem);
+extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_Semaphore *sem);
/**
* Wait until a semaphore has a positive value and then decrements it.
@@ -533,7 +533,7 @@ extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem);
* \sa SDL_WaitSemaphore
* \sa SDL_WaitSemaphoreTimeout
*/
-extern DECLSPEC int SDLCALL SDL_WaitSemaphore(SDL_sem *sem);
+extern DECLSPEC int SDLCALL SDL_WaitSemaphore(SDL_Semaphore *sem);
/**
* See if a semaphore has a positive value and decrement it if it does.
@@ -557,7 +557,7 @@ extern DECLSPEC int SDLCALL SDL_WaitSemaphore(SDL_sem *sem);
* \sa SDL_WaitSemaphore
* \sa SDL_WaitSemaphoreTimeout
*/
-extern DECLSPEC int SDLCALL SDL_TryWaitSemaphore(SDL_sem *sem);
+extern DECLSPEC int SDLCALL SDL_TryWaitSemaphore(SDL_Semaphore *sem);
/**
* Wait until a semaphore has a positive value and then decrements it.
@@ -582,7 +582,7 @@ extern DECLSPEC int SDLCALL SDL_TryWaitSemaphore(SDL_sem *sem);
* \sa SDL_GetSemaphoreValue
* \sa SDL_WaitSemaphore
*/
-extern DECLSPEC int SDLCALL SDL_WaitSemaphoreTimeout(SDL_sem *sem, Sint32 timeoutMS);
+extern DECLSPEC int SDLCALL SDL_WaitSemaphoreTimeout(SDL_Semaphore *sem, Sint32 timeoutMS);
/**
* Atomically increment a semaphore's value and wake waiting threads.
@@ -600,7 +600,7 @@ extern DECLSPEC int SDLCALL SDL_WaitSemaphoreTimeout(SDL_sem *sem, Sint32 timeou
* \sa SDL_WaitSemaphore
* \sa SDL_WaitSemaphoreTimeout
*/
-extern DECLSPEC int SDLCALL SDL_PostSemaphore(SDL_sem *sem);
+extern DECLSPEC int SDLCALL SDL_PostSemaphore(SDL_Semaphore *sem);
/**
* Get the current value of a semaphore.
@@ -612,7 +612,7 @@ extern DECLSPEC int SDLCALL SDL_PostSemaphore(SDL_sem *sem);
*
* \sa SDL_CreateSemaphore
*/
-extern DECLSPEC Uint32 SDLCALL SDL_GetSemaphoreValue(SDL_sem *sem);
+extern DECLSPEC Uint32 SDLCALL SDL_GetSemaphoreValue(SDL_Semaphore *sem);
/* @} *//* Semaphore functions */
@@ -623,8 +623,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetSemaphoreValue(SDL_sem *sem);
/* @{ */
/* The SDL condition variable structure, defined in SDL_syscond.c */
-struct SDL_cond;
-typedef struct SDL_cond SDL_cond;
+struct SDL_Condition;
+typedef struct SDL_Condition SDL_Condition;
/**
* Create a condition variable.
@@ -640,7 +640,7 @@ typedef struct SDL_cond SDL_cond;
* \sa SDL_WaitConditionTimeout
* \sa SDL_DestroyCondition
*/
-extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCondition(void);
+extern DECLSPEC SDL_Condition *SDLCALL SDL_CreateCondition(void);
/**
* Destroy a condition variable.
@@ -655,7 +655,7 @@ extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCondition(void);
* \sa SDL_WaitConditionTimeout
* \sa SDL_CreateCondition
*/
-extern DECLSPEC void SDLCALL SDL_DestroyCondition(SDL_cond *cond);
+extern DECLSPEC void SDLCALL SDL_DestroyCondition(SDL_Condition *cond);
/**
* Restart one of the threads that are waiting on the condition variable.
@@ -672,7 +672,7 @@ extern DECLSPEC void SDLCALL SDL_DestroyCondition(SDL_cond *cond);
* \sa SDL_CreateCondition
* \sa SDL_DestroyCondition
*/
-extern DECLSPEC int SDLCALL SDL_SignalCondition(SDL_cond *cond);
+extern DECLSPEC int SDLCALL SDL_SignalCondition(SDL_Condition *cond);
/**
* Restart all threads that are waiting on the condition variable.
@@ -689,7 +689,7 @@ extern DECLSPEC int SDLCALL SDL_SignalCondition(SDL_cond *cond);
* \sa SDL_CreateCondition
* \sa SDL_DestroyCondition
*/
-extern DECLSPEC int SDLCALL SDL_BroadcastCondition(SDL_cond *cond);
+extern DECLSPEC int SDLCALL SDL_BroadcastCondition(SDL_Condition *cond);
/**
* Wait until a condition variable is signaled.
@@ -719,7 +719,7 @@ extern DECLSPEC int SDLCALL SDL_BroadcastCondition(SDL_cond *cond);
* \sa SDL_CreateCondition
* \sa SDL_DestroyCondition
*/
-extern DECLSPEC int SDLCALL SDL_WaitCondition(SDL_cond *cond, SDL_mutex *mutex);
+extern DECLSPEC int SDLCALL SDL_WaitCondition(SDL_Condition *cond, SDL_Mutex *mutex);
/**
* Wait until a condition variable is signaled or a certain time has passed.
@@ -750,8 +750,8 @@ extern DECLSPEC int SDLCALL SDL_WaitCondition(SDL_cond *cond, SDL_mutex *mutex);
* \sa SDL_CreateCondition
* \sa SDL_DestroyCondition
*/
-extern DECLSPEC int SDLCALL SDL_WaitConditionTimeout(SDL_cond *cond,
- SDL_mutex *mutex, Sint32 timeoutMS);
+extern DECLSPEC int SDLCALL SDL_WaitConditionTimeout(SDL_Condition *cond,
+ SDL_Mutex *mutex, Sint32 timeoutMS);
/* @} *//* Condition variable functions */
diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h
index e9348eca9d98..3d2b55b3b8ed 100644
--- a/include/SDL3/SDL_oldnames.h
+++ b/include/SDL3/SDL_oldnames.h
@@ -327,6 +327,11 @@
#define SDL_SemWait SDL_WaitSemaphore
#define SDL_SemWaitTimeout SDL_WaitSemaphoreTimeout
+/* ##SDL_mutex.h */
+#define SDL_cond SDL_Condition
+#define SDL_mutex SDL_Mutex
+#define SDL_sem SDL_Semaphore
+
/* ##SDL_pixels.h */
#define SDL_AllocFormat SDL_CreatePixelFormat
#define SDL_AllocPalette SDL_CreatePalette
@@ -737,6 +742,11 @@
#define SDL_SemWait SDL_SemWait_renamed_SDL_WaitSemaphore
#define SDL_SemWaitTimeout SDL_SemWaitTimeout_renamed_SDL_WaitSemaphoreTimeout
+/* ##SDL_mutex.h */
+#define SDL_cond SDL_cond_renamed_SDL_Condition
+#define SDL_mutex SDL_mutex_renamed_SDL_Mutex
+#define SDL_sem SDL_sem_renamed_SDL_Semaphore
+
/* ##SDL_pixels.h */
#define SDL_AllocFormat SDL_AllocFormat_renamed_SDL_CreatePixelFormat
#define SDL_AllocPalette SDL_AllocPalette_renamed_SDL_CreatePalette
diff --git a/src/SDL_assert.c b/src/SDL_assert.c
index 10253987cc3b..8cca6d6ac999 100644
--- a/src/SDL_assert.c
+++ b/src/SDL_assert.c
@@ -49,7 +49,7 @@ static SDL_AssertState SDLCALL SDL_PromptAssertion(const SDL_AssertData *data, v
static SDL_AssertData *triggered_assertions = NULL;
#ifndef SDL_THREADS_DISABLED
-static SDL_mutex *assertion_mutex = NULL;
+static SDL_Mutex *assertion_mutex = NULL;
#endif
static SDL_AssertionHandler assertion_handler = SDL_PromptAssertion;
diff --git a/src/SDL_dataqueue.c b/src/SDL_dataqueue.c
index 4596101ba85f..f73ee0e9a197 100644
--- a/src/SDL_dataqueue.c
+++ b/src/SDL_dataqueue.c
@@ -32,7 +32,7 @@ typedef struct SDL_DataQueuePacket
struct SDL_DataQueue
{
- SDL_mutex *lock;
+ SDL_Mutex *lock;
SDL_DataQueuePacket *head; /* device fed from here. */
SDL_DataQueuePacket *tail; /* queue fills to here. */
SDL_DataQueuePacket *pool; /* these are unused packets. */
@@ -315,7 +315,7 @@ SDL_GetDataQueueSize(SDL_DataQueue *queue)
return retval;
}
-SDL_mutex *
+SDL_Mutex *
SDL_GetDataQueueMutex(SDL_DataQueue *queue)
{
return queue ? queue->lock : NULL;
diff --git a/src/SDL_dataqueue.h b/src/SDL_dataqueue.h
index 51b3641e3ec0..c9ea83054c41 100644
--- a/src/SDL_dataqueue.h
+++ b/src/SDL_dataqueue.h
@@ -33,6 +33,6 @@ int SDL_WriteToDataQueue(SDL_DataQueue *queue, const void *data, const size_t le
size_t SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *buf, const size_t len);
size_t SDL_PeekIntoDataQueue(SDL_DataQueue *queue, void *buf, const size_t len);
size_t SDL_GetDataQueueSize(SDL_DataQueue *queue);
-SDL_mutex *SDL_GetDataQueueMutex(SDL_DataQueue *queue); /* don't destroy this, obviously. */
+SDL_Mutex *SDL_GetDataQueueMutex(SDL_DataQueue *queue); /* don't destroy this, obviously. */
#endif /* SDL_dataqueue_h_ */
diff --git a/src/SDL_internal.h b/src/SDL_internal.h
index 4cc6319cba6d..3e2148c3df10 100644
--- a/src/SDL_internal.h
+++ b/src/SDL_internal.h
@@ -197,8 +197,8 @@
extern "C" {
#endif
-extern DECLSPEC int SDLCALL SDL_WaitSemaphoreTimeoutNS(SDL_sem *sem, Sint64 timeoutNS);
-extern DECLSPEC int SDLCALL SDL_WaitConditionTimeoutNS(SDL_cond *cond, SDL_mutex *mutex, Sint64 timeoutNS);
+extern DECLSPEC int SDLCALL SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS);
+extern DECLSPEC int SDLCALL SDL_WaitConditionTimeoutNS(SDL_Condition *cond, SDL_Mutex *mutex, Sint64 timeoutNS);
extern DECLSPEC int SDLCALL SDL_WaitEventTimeoutNS(SDL_Event *event, Sint64 timeoutNS);
/* Ends C function definitions when using C++ */
diff --git a/src/SDL_log.c b/src/SDL_log.c
index 7d17186a3f77..25eb60b62dd9 100644
--- a/src/SDL_log.c
+++ b/src/SDL_log.c
@@ -63,7 +63,7 @@ static SDL_LogPriority SDL_application_priority = DEFAULT_APPLICATION_PRIORITY;
static SDL_LogPriority SDL_test_priority = DEFAULT_TEST_PRIORITY;
static SDL_LogOutputFunction SDL_log_function = SDL_LogOutput;
static void *SDL_log_userdata = NULL;
-static SDL_mutex *log_function_mutex = NULL;
+static SDL_Mutex *log_function_mutex = NULL;
#ifdef __GNUC__
#pragma GCC diagnostic push
diff --git a/src/atomic/SDL_spinlock.c b/src/atomic/SDL_spinlock.c
index 25ae1d0ddcdb..f9d436816873 100644
--- a/src/atomic/SDL_spinlock.c
+++ b/src/atomic/SDL_spinlock.c
@@ -62,7 +62,7 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
{
#ifdef SDL_ATOMIC_DISABLED
/* Terrible terrible damage */
- static SDL_mutex *_spinlock_mutex;
+ static SDL_Mutex *_spinlock_mutex;
if (_spinlock_mutex == NULL) {
/* Race condition on first lock... */
diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c
index ec630781182d..5880c8bf8471 100644
--- a/src/audio/SDL_audiocvt.c
+++ b/src/audio/SDL_audiocvt.c
@@ -437,7 +437,7 @@ static void ConvertAudio(int num_frames, const void *src, SDL_AudioFormat src_fo
struct SDL_AudioStream
{
SDL_DataQueue *queue;
- SDL_mutex *lock; /* this is just a copy of `queue`'s mutex. We share a lock. */
+ SDL_Mutex *lock; /* this is just a copy of `queue`'s mutex. We share a lock. */
Uint8 *work_buffer; /* used for scratch space during data conversion/resampling. */
Uint8 *history_buffer; /* history for left padding and future sample rate changes. */
diff --git a/src/audio/SDL_sysaudio.h b/src/audio/SDL_sysaudio.h
index 7a49b4e9ce75..f82d2d654622 100644
--- a/src/audio/SDL_sysaudio.h
+++ b/src/audio/SDL_sysaudio.h
@@ -112,7 +112,7 @@ typedef struct SDL_AudioDriver
SDL_AudioDriverImpl impl;
/* A mutex for device detection */
- SDL_mutex *detectionLock;
+ SDL_Mutex *detectionLock;
SDL_bool captureDevicesRemoved;
SDL_bool outputDevicesRemoved;
int outputDeviceCount;
@@ -150,7 +150,7 @@ struct SDL_AudioDevice
Uint32 work_buffer_len;
/* A mutex for locking the mixing buffers */
- SDL_mutex *mixer_lock;
+ SDL_Mutex *mixer_lock;
/* A thread to feed the audio device */
SDL_Thread *thread;
diff --git a/src/audio/coreaudio/SDL_coreaudio.h b/src/audio/coreaudio/SDL_coreaudio.h
index 8509a246d0ff..c3406e907ca4 100644
--- a/src/audio/coreaudio/SDL_coreaudio.h
+++ b/src/audio/coreaudio/SDL_coreaudio.h
@@ -60,7 +60,7 @@ struct SDL_PrivateAudioData
UInt32 bufferOffset;
UInt32 bufferSize;
AudioStreamBasicDescription strdesc;
- SDL_sem *ready_semaphore;
+ SDL_Semaphore *ready_semaphore;
char *thread_error;
#ifdef MACOSX_COREAUDIO
AudioDeviceID deviceID;
diff --git a/src/audio/jack/SDL_jackaudio.h b/src/audio/jack/SDL_jackaudio.h
index b4c9cd84c143..7f26472ae9b1 100644
--- a/src/audio/jack/SDL_jackaudio.h
+++ b/src/audio/jack/SDL_jackaudio.h
@@ -31,7 +31,7 @@
struct SDL_PrivateAudioData
{
jack_client_t *client;
- SDL_sem *iosem;
+ SDL_Semaphore *iosem;
float *iobuffer;
jack_port_t **sdlports;
};
diff --git a/src/audio/openslES/SDL_openslES.h b/src/audio/openslES/SDL_openslES.h
index ec7a5759eb1d..291f1d3b23e3 100644
--- a/src/audio/openslES/SDL_openslES.h
+++ b/src/audio/openslES/SDL_openslES.h
@@ -35,7 +35,7 @@ struct SDL_PrivateAudioData
Uint8 *mixbuff;
int next_buffer;
Uint8 *pmixbuff[NUM_BUFFERS];
- SDL_sem *playsem;
+ SDL_Semaphore *playsem;
};
void openslES_ResumeDevices(void);
diff --git a/src/audio/wasapi/SDL_wasapi_winrt.cpp b/src/audio/wasapi/SDL_wasapi_winrt.cpp
index f60180c774a7..c9aa4f3b48a4 100644
--- a/src/audio/wasapi/SDL_wasapi_winrt.cpp
+++ b/src/audio/wasapi/SDL_wasapi_winrt.cpp
@@ -80,7 +80,7 @@ class SDL_WasapiDeviceEventHandler
void OnEnumerationCompleted(DeviceWatcher ^ sender, Platform::Object ^ args);
void OnDefaultRenderDeviceChanged(Platform::Object ^ sender, DefaultAudioRenderDeviceChangedEventArgs ^ args);
void OnDefaultCaptureDeviceChanged(Platform::Object ^ sender, DefaultAudioCaptureDeviceChangedEventArgs ^ args);
- SDL_semaphore *completed;
+ SDL_Semaphore *completed;
private:
const SDL_bool iscapture;
diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
index fae09a6702c0..e59b2d9de32d 100644
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -149,22 +149,22 @@ SDL_DYNAPI_PROC(void,SDL_CloseGamepad,(SDL_Gamepad *a),(a),)
SDL_DYNAPI_PROC(void,SDL_CloseJoystick,(SDL_Joystick *a),(a),)
SDL_DYNAPI_PROC(void,SDL_CloseSensor,(SDL_Sensor *a),(a),)
SDL_DYNAPI_PROC(SDL_BlendMode,SDL_ComposeCustomBlendMode,(SDL_BlendFactor a, SDL_BlendFactor b, SDL_BlendOperation c, SDL_BlendFactor d, SDL_BlendFactor e, SDL_BlendOperation f),(a,b,c,d,e,f),return)
-SDL_DYNAPI_PROC(int,SDL_BroadcastCondition,(SDL_cond *a),(a),return)
-SDL_DYNAPI_PROC(int,SDL_SignalCondition,(SDL_cond *a),(a),return)
-SDL_DYNAPI_PROC(int,SDL_WaitCondition,(SDL_cond *a, SDL_mutex *b),(a,b),return)
-SDL_DYNAPI_PROC(int,SDL_WaitConditionTimeout,(SDL_cond *a, SDL_mutex *b, Sint32 c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_BroadcastCondition,(SDL_Condition *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_SignalCondition,(SDL_Condition *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_WaitCondition,(SDL_Condition *a, SDL_Mutex *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_WaitConditionTimeout,(SDL_Condition *a, SDL_Mutex *b, Sint32 c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_ConvertPixels,(int a, int b, Uint32 c, const void *d, int e, Uint32 f, void *g, int h),(a,b,c,d,e,f,g,h),return)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_ConvertSurface,(SDL_Surface *a, const SDL_PixelFormat *b),(a,b),return)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_ConvertSurfaceFormat,(SDL_Surface *a, Uint32 b),(a,b),return)
SDL_DYNAPI_PROC(SDL_AudioStream*,SDL_CreateAudioStream,(SDL_AudioFormat a, int b, int c, SDL_AudioFormat d, int e, int f),(a,b,c,d,e,f),return)
SDL_DYNAPI_PROC(SDL_Cursor*,SDL_CreateColorCursor,(SDL_Surface *a, int b, int c),(a,b,c),return)
-SDL_DYNAPI_PROC(SDL_cond*,SDL_CreateCondition,(void),(),return)
+SDL_DYNAPI_PROC(SDL_Condition*,SDL_CreateCondition,(void),(),return)
SDL_DYNAPI_PROC(SDL_Cursor*,SDL_CreateCursor,(const Uint8 *a, const Uint8 *b, int c, int d, int e, int f),(a,b,c,d,e,f),return)
-SDL_DYNAPI_PROC(SDL_mutex*,SDL_CreateMutex,(void),(),return)
+SDL_DYNAPI_PROC(SDL_Mutex*,SDL_CreateMutex,(void),(),return)
SDL_DYNAPI_PROC(SDL_Palette*,SDL_CreatePalette,(int a),(a),return)
SDL_DYNAPI_PROC(SDL_PixelFormat*,SDL_CreatePixelFormat,(Uint32 a),(a),return)
SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateRenderer,(SDL_Window *a, const char *b, Uint32 c),(a,b,c),return)
-SDL_DYNAPI_PROC(SDL_sem*,SDL_CreateSemaphore,(Uint32 a),(a),return)
+SDL_DYNAPI_PROC(SDL_Semaphore*,SDL_CreateSemaphore,(Uint32 a),(a),return)
SDL_DYNAPI_PROC(SDL_Window*,SDL_CreateShapedWindow,(const char *a, int b, int c, Uint32 d),(a,b,c,d),return)
SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateSoftwareRenderer,(SDL_Surface *a),(a),return)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateSurface,(int a, int b, Uint32 c),(a,b,c),return)
@@ -182,12 +182,12 @@ SDL_DYNAPI_PROC(void,SDL_Delay,(Uint32 a),(a),)
SDL_DYNAPI_PROC(void,SDL_DelayNS,(Uint64 a),(a),)
SDL_DYNAPI_PROC(Uint32,SDL_DequeueAudio,(SDL_AudioDeviceID a, void *b, Uint32 c),(a,b,c),return)
SDL_DYNAPI_PROC(void,SDL_DestroyAudioStream,(SDL_AudioStream *a),(a),)
-SDL_DYNAPI_PROC(void,SDL_DestroyCondition,(SDL_cond *a),(a),)
-SDL_DYNAPI_PROC(void,SDL_DestroyMutex,(SDL_mutex *a),(a),)
+SDL_DYNAPI_PROC(void,SDL_DestroyCondition,(SDL_Condition *a),(a),)
+SDL_DYNAPI_PROC(void,SDL_DestroyMutex,(SDL_Mutex *a),(a),)
SDL_DYNAPI_PROC(void,SDL_DestroyPalette,(SDL_Palette *a),(a),)
SDL_DYNAPI_PROC(void,SDL_DestroyPixelFormat,(SDL_PixelFormat *a),(a),)
SDL_DYNAPI_PROC(void,SDL_DestroyRenderer,(SDL_Renderer *a),(a),)
-SDL_DYNAPI_PROC(void,SDL_DestroySemaphore,(SDL_sem *a),(a),)
+SDL_DYNAPI_PROC(void,SDL_DestroySemaphore,(SDL_Semaphore *a),(a),)
SDL_DYNAPI_PROC(void,SDL_DestroySurface,(SDL_Surface *a),(a),)
SDL_DYNAPI_PROC(void,SDL_DestroyTexture,(SDL_Texture *a),(a),)
SDL_DYNAPI_PROC(void,SDL_DestroyWindow,(SDL_Window *a),(a),)
@@ -530,7 +530,7 @@ SDL_DYNAPI_PROC(void*,SDL_LoadObject,(const char *a),(a),return)
SDL_DYNAPI_PROC(SDL_AudioSpec*,SDL_LoadWAV_RW,(SDL_RWops *a, int b, SDL_AudioSpec *c, Uint8 **d, Uint32 *e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(int,SDL_LockAudioDevice,(SDL_AudioDeviceID a),(a),return)
SDL_DYNAPI_PROC(void,SDL_LockJoysticks,(void),(),)
-SDL_DYNAPI_PROC(int,SDL_LockMutex,(SDL_mutex *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_LockMutex,(SDL_Mutex *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_LockSurface,(SDL_Surface *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_LockTexture,(SDL_Texture *a, const SDL_Rect *b, void **c, int *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_LockTextureToSurface,(SDL_Texture *a, const SDL_Rect *b, SDL_Surface **c),(a,b,c),return)
@@ -628,11 +628,11 @@ SDL_DYNAPI_PROC(size_t,SDL_SIMDGetAlignment,(void),(),return)
SDL_DYNAPI_PROC(int,SDL_SaveBMP_RW,(SDL_Surface *a, SDL_RWops *b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_ScreenKeyboardShown,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_ScreenSaverEnabled,(void),(),return)
-SDL_DYNAPI_PROC(int,SDL_PostSemaphore,(SDL_sem *a),(a),return)
-SDL_DYNAPI_PROC(int,SDL_TryWaitSemaphore,(SDL_sem *a),(a),return)
-SDL_DYNAPI_PROC(Uint32,SDL_GetSemaphoreValue,(SDL_sem *a),(a),return)
-SDL_DYNAPI_PROC(int,SDL_WaitSemaphore,(SDL_sem *a),(a),return)
-SDL_DYNAPI_PROC(int,SDL_WaitSemaphoreTimeout,(SDL_sem *a, Sint32 b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_PostSemaphore,(SDL_Semaphore *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_TryWaitSemaphore,(SDL_Semaphore *a),(a),return)
+SDL_DYNAPI_PROC(Uint32,SDL_GetSemaphoreValue,(SDL_Semaphore *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_WaitSemaphore,(SDL_Semaphore *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_WaitSemaphoreTimeout,(SDL_Semaphore *a, Sint32 b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_SendGamepadEffect,(SDL_Gamepad *a, const void *b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_SendJoystickEffect,(SDL_Joystick *a, const void *b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(void,SDL_SetAssertionHandler,(SDL_AssertionHandler a, void *b),(a,b),)
@@ -719,11 +719,11 @@ SDL_DYNAPI_PROC(int,SDL_TLSSet,(SDL_TLSID a, const void *b, void (SDLCALL *c)(vo
SDL_DYNAPI_PROC(SDL_bool,SDL_TextInputActive,(void),(),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_TextInputShown,(void),(),return)
SDL_DYNAPI_PROC(SDL_threadID,SDL_ThreadID,(void),(),return)
-SDL_DYNAPI_PROC(int,SDL_TryLockMutex,(SDL_mutex *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_TryLockMutex,(SDL_Mutex *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_UnloadObject,(void *a),(a),)
SDL_DYNAPI_PROC(void,SDL_UnlockAudioDevice,(SDL_AudioDeviceID a),(a),)
SDL_DYNAPI_PROC(void,SDL_UnlockJoysticks,(void),(),)
-SDL_DYNAPI_PROC(int,SDL_UnlockMutex,(SDL_mutex *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_UnlockMutex,(SDL_Mutex *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_UnlockSurface,(SDL_Surface *a),(a),)
SDL_DYNAPI_PROC(void,SDL_UnlockTexture,(SDL_Texture *a),(a),)
SDL_DYNAPI_PROC(void,SDL_UpdateGamepads,(void),(),)
@@ -915,10 +915,10 @@ SDL_DYNAPI_PROC(SDL_Window*,SDL_GetWindowParent,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(SDL_Window*,SDL_CreateWindowWithPosition,(const char *a, int
(Patch may be truncated, please check the link at the top of this post.)