Rename SDL mutex, semaphore and condition variable types to match SDL 3.0 naming convention

main
Sam Lantinga 2023-04-28 07:31:12 -07:00
parent 61c0c009ab
commit 87ad71f9b2
75 changed files with 452 additions and 422 deletions

View File

@ -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

View File

@ -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)).

View File

@ -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;

View File

@ -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 */

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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_ */

View File

@ -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++ */

View File

@ -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

View File

@ -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... */

View File

@ -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. */

View File

@ -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;

View File

@ -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;

View File

@ -31,7 +31,7 @@
struct SDL_PrivateAudioData
{
jack_client_t *client;
SDL_sem *iosem;
SDL_Semaphore *iosem;
float *iobuffer;
jack_port_t **sdlports;
};

View File

@ -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);

View File

@ -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;

View File

@ -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 b, int c, int d, int e, Uint32 f),(a,b,c,d,e,f),return)
SDL_DYNAPI_PROC(int,SDL_GetAudioStreamFormat,(SDL_AudioStream *a, SDL_AudioFormat *b, int *c, int *d, SDL_AudioFormat *e, int *f, int *g),(a,b,c,d,e,f,g),return)
SDL_DYNAPI_PROC(int,SDL_SetAudioStreamFormat,(SDL_AudioStream *a, SDL_AudioFormat b, int c, int d, SDL_AudioFormat e, int f, int g),(a,b,c,d,e,f,g),return)
SDL_DYNAPI_PROC(SDL_rwlock*,SDL_CreateRWLock,(void),(),return)
SDL_DYNAPI_PROC(int,SDL_LockRWLockForReading,(SDL_rwlock *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_LockRWLockForWriting,(SDL_rwlock *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_TryLockRWLockForReading,(SDL_rwlock *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_TryLockRWLockForWriting,(SDL_rwlock *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_UnlockRWLock,(SDL_rwlock *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_DestroyRWLock,(SDL_rwlock *a),(a),)
SDL_DYNAPI_PROC(SDL_RWLock*,SDL_CreateRWLock,(void),(),return)
SDL_DYNAPI_PROC(int,SDL_LockRWLockForReading,(SDL_RWLock *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_LockRWLockForWriting,(SDL_RWLock *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_TryLockRWLockForReading,(SDL_RWLock *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_TryLockRWLockForWriting,(SDL_RWLock *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_UnlockRWLock,(SDL_RWLock *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_DestroyRWLock,(SDL_RWLock *a),(a),)

View File

@ -54,7 +54,7 @@ typedef struct SDL_EventWatcher
SDL_bool removed;
} SDL_EventWatcher;
static SDL_mutex *SDL_event_watchers_lock;
static SDL_Mutex *SDL_event_watchers_lock;
static SDL_EventWatcher SDL_EventOK;
static SDL_EventWatcher *SDL_event_watchers = NULL;
static int SDL_event_watchers_count = 0;
@ -87,7 +87,7 @@ typedef struct SDL_SysWMEntry
static struct
{
SDL_mutex *lock;
SDL_Mutex *lock;
SDL_bool active;
SDL_AtomicInt count;
int max_events_seen;

View File

@ -45,7 +45,7 @@ struct haptic_hwdata
Uint8 bXInputHaptic; /* Supports force feedback via XInput. */
Uint8 userid; /* XInput userid index for this joystick */
SDL_Thread *thread;
SDL_mutex *mutex;
SDL_Mutex *mutex;
Uint64 stopTicks;
SDL_AtomicInt stopThread;
};

View File

@ -93,8 +93,8 @@ namespace NAMESPACE
typedef struct _SDL_ThreadBarrier
{
SDL_mutex *mutex;
SDL_cond *cond;
SDL_Mutex *mutex;
SDL_Condition *cond;
Uint32 count;
Uint32 trip_count;
} SDL_ThreadBarrier;
@ -193,8 +193,8 @@ struct hid_device_ {
/* Read thread objects */
SDL_Thread *thread;
SDL_mutex *mutex; /* Protects input_reports */
SDL_cond *condition;
SDL_Mutex *mutex; /* Protects input_reports */
SDL_Condition *condition;
SDL_ThreadBarrier barrier; /* Ensures correct startup sequence */
int shutdown_thread;
int transfer_loop_finished;

View File

@ -108,7 +108,7 @@ static SDL_JoystickDriver *SDL_joystick_drivers[] = {
#ifndef SDL_THREAD_SAFETY_ANALYSIS
static
#endif
SDL_mutex *SDL_joystick_lock = NULL; /* This needs to support recursive locks */
SDL_Mutex *SDL_joystick_lock = NULL; /* This needs to support recursive locks */
static int SDL_joysticks_locked;
static SDL_bool SDL_joysticks_initialized;
static SDL_bool SDL_joysticks_quitting = SDL_FALSE;

View File

@ -44,7 +44,7 @@ typedef struct SDL_HIDAPI_RumbleContext
SDL_AtomicInt initialized;
SDL_AtomicInt running;
SDL_Thread *thread;
SDL_sem *request_sem;
SDL_Semaphore *request_sem;
SDL_HIDAPI_RumbleRequest *requests_head;
SDL_HIDAPI_RumbleRequest *requests_tail;
} SDL_HIDAPI_RumbleContext;
@ -52,7 +52,7 @@ typedef struct SDL_HIDAPI_RumbleContext
#ifndef SDL_THREAD_SAFETY_ANALYSIS
static
#endif
SDL_mutex *SDL_HIDAPI_rumble_lock;
SDL_Mutex *SDL_HIDAPI_rumble_lock;
static SDL_HIDAPI_RumbleContext rumble_context SDL_GUARDED_BY(SDL_HIDAPI_rumble_lock);
static int SDLCALL SDL_HIDAPI_RumbleThread(void *data)

View File

@ -26,7 +26,7 @@
/* Advanced API */
#ifdef SDL_THREAD_SAFETY_ANALYSIS
extern SDL_mutex *SDL_HIDAPI_rumble_lock;
extern SDL_Mutex *SDL_HIDAPI_rumble_lock;
#endif
int SDL_HIDAPI_LockRumble(void) SDL_TRY_ACQUIRE(0, SDL_HIDAPI_rumble_lock);
SDL_bool SDL_HIDAPI_GetPendingRumbleLocked(SDL_HIDAPI_Device *device, Uint8 **data, int **size, int *maximum_size);

View File

@ -70,7 +70,7 @@ typedef struct SDL_HIDAPI_Device
struct SDL_HIDAPI_DeviceDriver *driver;
void *context;
SDL_mutex *dev_lock;
SDL_Mutex *dev_lock;
SDL_hid_device *dev;
SDL_AtomicInt rumble_pending;
int num_joysticks;

View File

@ -145,8 +145,8 @@ typedef DWORD(WINAPI *CM_Unregister_NotificationFunc)(HCMNOTIFICATION NotifyCont
/* local variables */
static SDL_bool s_bJoystickThread = SDL_FALSE;
static SDL_bool s_bWindowsDeviceChanged = SDL_FALSE;
static SDL_cond *s_condJoystickThread = NULL;
static SDL_mutex *s_mutexJoyStickEnum = NULL;
static SDL_Condition *s_condJoystickThread = NULL;
static SDL_Mutex *s_mutexJoyStickEnum = NULL;
static SDL_Thread *s_joystickThread = NULL;
static SDL_bool s_bJoystickThreadQuit = SDL_FALSE;
static GUID GUID_DEVINTERFACE_HID = { 0x4D1E55B2L, 0xF16F, 0x11CF, { 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30 } };
@ -313,7 +313,7 @@ static int SDL_CreateDeviceNotification(SDL_DeviceNotificationData *data)
return 0;
}
static SDL_bool SDL_WaitForDeviceNotification(SDL_DeviceNotificationData *data, SDL_mutex *mutex)
static SDL_bool SDL_WaitForDeviceNotification(SDL_DeviceNotificationData *data, SDL_Mutex *mutex)
{
MSG msg;
int lastret = 1;

View File

@ -247,7 +247,7 @@ struct SDL_Renderer
/* The list of textures */
SDL_Texture *textures;
SDL_Texture *target;
SDL_mutex *target_mutex;
SDL_Mutex *target_mutex;
SDL_Color color; /**< Color for drawing operations values */
SDL_BlendMode blendMode; /**< The drawing blend mode */

View File

@ -48,7 +48,7 @@ static SDL_SensorDriver *SDL_sensor_drivers[] = {
&SDL_DUMMY_SensorDriver
#endif
};
static SDL_mutex *SDL_sensor_lock = NULL; /* This needs to support recursive locks */
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_AtomicInt SDL_last_sensor_instance_id SDL_GUARDED_BY(SDL_sensor_lock);

View File

@ -110,7 +110,7 @@ typedef struct SDL_TLSEntry
struct SDL_TLSEntry *next;
} SDL_TLSEntry;
static SDL_mutex *SDL_generic_TLS_mutex;
static SDL_Mutex *SDL_generic_TLS_mutex;
static SDL_TLSEntry *SDL_generic_TLS;
SDL_TLSData *
@ -125,7 +125,7 @@ SDL_Generic_GetTLSData(void)
static SDL_SpinLock tls_lock;
SDL_AtomicLock(&tls_lock);
if (SDL_generic_TLS_mutex == NULL) {
SDL_mutex *mutex = SDL_CreateMutex();
SDL_Mutex *mutex = SDL_CreateMutex();
SDL_MemoryBarrierRelease();
SDL_generic_TLS_mutex = mutex;
if (SDL_generic_TLS_mutex == NULL) {
@ -481,17 +481,17 @@ void SDL_DetachThread(SDL_Thread *thread)
}
}
int SDL_WaitSemaphore(SDL_sem *sem)
int SDL_WaitSemaphore(SDL_Semaphore *sem)
{
return SDL_WaitSemaphoreTimeoutNS(sem, SDL_MUTEX_MAXWAIT);
}
int SDL_TryWaitSemaphore(SDL_sem *sem)
int SDL_TryWaitSemaphore(SDL_Semaphore *sem)
{
return SDL_WaitSemaphoreTimeoutNS(sem, 0);
}
int SDL_WaitSemaphoreTimeout(SDL_sem *sem, Sint32 timeoutMS)
int SDL_WaitSemaphoreTimeout(SDL_Semaphore *sem, Sint32 timeoutMS)
{
Sint64 timeoutNS;
@ -503,12 +503,12 @@ int SDL_WaitSemaphoreTimeout(SDL_sem *sem, Sint32 timeoutMS)
return SDL_WaitSemaphoreTimeoutNS(sem, timeoutNS);
}
int SDL_WaitCondition(SDL_cond *cond, SDL_mutex *mutex)
int SDL_WaitCondition(SDL_Condition *cond, SDL_Mutex *mutex)
{
return SDL_WaitConditionTimeoutNS(cond, mutex, SDL_MUTEX_MAXWAIT);
}
int SDL_WaitConditionTimeout(SDL_cond *cond, SDL_mutex *mutex, Sint32 timeoutMS)
int SDL_WaitConditionTimeout(SDL_Condition *cond, SDL_Mutex *mutex, Sint32 timeoutMS)
{
Sint64 timeoutNS;

View File

@ -42,15 +42,15 @@
typedef struct SDL_cond_generic
{
SDL_mutex *lock;
SDL_Mutex *lock;
int waiting;
int signals;
SDL_sem *wait_sem;
SDL_sem *wait_done;
SDL_Semaphore *wait_sem;
SDL_Semaphore *wait_done;
} SDL_cond_generic;
/* Create a condition variable */
SDL_cond *
SDL_Condition *
SDL_CreateCondition_generic(void)
{
SDL_cond_generic *cond;
@ -62,17 +62,17 @@ SDL_CreateCondition_generic(void)
cond->wait_done = SDL_CreateSemaphore(0);
cond->waiting = cond->signals = 0;
if (!cond->lock || !cond->wait_sem || !cond->wait_done) {
SDL_DestroyCondition_generic((SDL_cond *)cond);
SDL_DestroyCondition_generic((SDL_Condition *)cond);
cond = NULL;
}
} else {
SDL_OutOfMemory();
}
return (SDL_cond *)cond;
return (SDL_Condition *)cond;
}
/* Destroy a condition variable */
void SDL_DestroyCondition_generic(SDL_cond *_cond)
void SDL_DestroyCondition_generic(SDL_Condition *_cond)
{
SDL_cond_generic *cond = (SDL_cond_generic *)_cond;
if (cond) {
@ -90,7 +90,7 @@ void SDL_DestroyCondition_generic(SDL_cond *_cond)
}
/* Restart one of the threads that are waiting on the condition variable */
int SDL_SignalCondition_generic(SDL_cond *_cond)
int SDL_SignalCondition_generic(SDL_Condition *_cond)
{
SDL_cond_generic *cond = (SDL_cond_generic *)_cond;
if (cond == NULL) {
@ -114,7 +114,7 @@ int SDL_SignalCondition_generic(SDL_cond *_cond)
}
/* Restart all threads that are waiting on the condition variable */
int SDL_BroadcastCondition_generic(SDL_cond *_cond)
int SDL_BroadcastCondition_generic(SDL_Condition *_cond)
{
SDL_cond_generic *cond = (SDL_cond_generic *)_cond;
if (cond == NULL) {
@ -168,7 +168,7 @@ Thread B:
SDL_SignalCondition(cond);
SDL_UnlockMutex(lock);
*/
int SDL_WaitConditionTimeoutNS_generic(SDL_cond *_cond, SDL_mutex *mutex, Sint64 timeoutNS)
int SDL_WaitConditionTimeoutNS_generic(SDL_Condition *_cond, SDL_Mutex *mutex, Sint64 timeoutNS)
{
SDL_cond_generic *cond = (SDL_cond_generic *)_cond;
int retval;

View File

@ -25,11 +25,11 @@
#ifdef SDL_THREAD_GENERIC_COND_SUFFIX
SDL_cond *SDL_CreateCondition_generic(void);
void SDL_DestroyCondition_generic(SDL_cond *cond);
int SDL_SignalCondition_generic(SDL_cond *cond);
int SDL_BroadcastCondition_generic(SDL_cond *cond);
int SDL_WaitConditionTimeoutNS_generic(SDL_cond *cond, SDL_mutex *mutex, Sint64 timeoutNS);
SDL_Condition *SDL_CreateCondition_generic(void);
void SDL_DestroyCondition_generic(SDL_Condition *cond);
int SDL_SignalCondition_generic(SDL_Condition *cond);
int SDL_BroadcastCondition_generic(SDL_Condition *cond);
int SDL_WaitConditionTimeoutNS_generic(SDL_Condition *cond, SDL_Mutex *mutex, Sint64 timeoutNS);
#endif /* SDL_THREAD_GENERIC_COND_SUFFIX */

View File

@ -24,21 +24,21 @@
#include "SDL_systhread_c.h"
struct SDL_mutex
struct SDL_Mutex
{
int recursive;
SDL_threadID owner;
SDL_sem *sem;
SDL_Semaphore *sem;
};
/* Create a mutex */
SDL_mutex *
SDL_Mutex *
SDL_CreateMutex(void)
{
SDL_mutex *mutex;
SDL_Mutex *mutex;
/* Allocate mutex memory */
mutex = (SDL_mutex *)SDL_calloc(1, sizeof(*mutex));
mutex = (SDL_Mutex *)SDL_calloc(1, sizeof(*mutex));
#ifndef SDL_THREADS_DISABLED
if (mutex) {
@ -59,7 +59,7 @@ SDL_CreateMutex(void)
}
/* Free the mutex */
void SDL_DestroyMutex(SDL_mutex *mutex)
void SDL_DestroyMutex(SDL_Mutex *mutex)
{
if (mutex) {
if (mutex->sem) {
@ -70,7 +70,7 @@ void SDL_DestroyMutex(SDL_mutex *mutex)
}
/* Lock the mutex */
int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
int SDL_LockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
#ifdef SDL_THREADS_DISABLED
return 0;
@ -99,7 +99,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn
}
/* try Lock the mutex */
int SDL_TryLockMutex(SDL_mutex *mutex)
int SDL_TryLockMutex(SDL_Mutex *mutex)
{
#ifdef SDL_THREADS_DISABLED
return 0;
@ -131,7 +131,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
}
/* Unlock the mutex */
int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
int SDL_UnlockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
#ifdef SDL_THREADS_DISABLED
return 0;

View File

@ -41,18 +41,18 @@
#define SDL_UnlockRWLock_generic SDL_UnlockRWLock
#endif
struct SDL_rwlock
struct SDL_RWLock
{
SDL_mutex *lock;
SDL_cond *condition;
SDL_Mutex *lock;
SDL_Condition *condition;
SDL_threadID writer_thread;
SDL_AtomicInt reader_count;
SDL_AtomicInt writer_count;
};
SDL_rwlock *SDL_CreateRWLock_generic(void)
SDL_RWLock *SDL_CreateRWLock_generic(void)
{
SDL_rwlock *rwlock = (SDL_rwlock *) SDL_malloc(sizeof (*rwlock));
SDL_RWLock *rwlock = (SDL_RWLock *) SDL_malloc(sizeof (*rwlock));
if (!rwlock) {
SDL_OutOfMemory();
@ -78,7 +78,7 @@ SDL_rwlock *SDL_CreateRWLock_generic(void)
return rwlock;
}
void SDL_DestroyRWLock_generic(SDL_rwlock *rwlock)
void SDL_DestroyRWLock_generic(SDL_RWLock *rwlock)
{
if (rwlock) {
SDL_DestroyMutex(rwlock->lock);
@ -87,7 +87,7 @@ void SDL_DestroyRWLock_generic(SDL_rwlock *rwlock)
}
}
int SDL_LockRWLockForReading_generic(SDL_rwlock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
int SDL_LockRWLockForReading_generic(SDL_RWLock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
if (!rwlock) {
return SDL_InvalidParamError("rwlock");
@ -102,7 +102,7 @@ int SDL_LockRWLockForReading_generic(SDL_rwlock *rwlock) SDL_NO_THREAD_SAFETY_AN
return 0;
}
int SDL_LockRWLockForWriting_generic(SDL_rwlock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
int SDL_LockRWLockForWriting_generic(SDL_RWLock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
if (!rwlock) {
return SDL_InvalidParamError("rwlock");
@ -120,7 +120,7 @@ int SDL_LockRWLockForWriting_generic(SDL_rwlock *rwlock) SDL_NO_THREAD_SAFETY_AN
return 0;
}
int SDL_TryLockRWLockForReading_generic(SDL_rwlock *rwlock)
int SDL_TryLockRWLockForReading_generic(SDL_RWLock *rwlock)
{
int rc;
@ -141,7 +141,7 @@ int SDL_TryLockRWLockForReading_generic(SDL_rwlock *rwlock)
return 0;
}
int SDL_TryLockRWLockForWriting_generic(SDL_rwlock *rwlock)
int SDL_TryLockRWLockForWriting_generic(SDL_RWLock *rwlock)
{
int rc;
@ -162,7 +162,7 @@ int SDL_TryLockRWLockForWriting_generic(SDL_rwlock *rwlock)
return 0;
}
int SDL_UnlockRWLock_generic(SDL_rwlock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
int SDL_UnlockRWLock_generic(SDL_RWLock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
if (!rwlock) {
return SDL_InvalidParamError("rwlock");

View File

@ -25,13 +25,13 @@
#ifdef SDL_THREAD_GENERIC_RWLOCK_SUFFIX
SDL_rwlock *SDL_CreateRWLock_generic(void);
void SDL_DestroyRWLock_generic(SDL_rwlock *rwlock);
int SDL_LockRWLockForReading_generic(SDL_rwlock *rwlock);
int SDL_LockRWLockForWriting_generic(SDL_rwlock *rwlock);
int SDL_TryLockRWLockForReading_generic(SDL_rwlock *rwlock);
int SDL_TryLockRWLockForWriting_generic(SDL_rwlock *rwlock);
int SDL_UnlockRWLock_generic(SDL_rwlock *rwlock);
SDL_RWLock *SDL_CreateRWLock_generic(void);
void SDL_DestroyRWLock_generic(SDL_RWLock *rwlock);
int SDL_LockRWLockForReading_generic(SDL_RWLock *rwlock);
int SDL_LockRWLockForWriting_generic(SDL_RWLock *rwlock);
int SDL_TryLockRWLockForReading_generic(SDL_RWLock *rwlock);
int SDL_TryLockRWLockForWriting_generic(SDL_RWLock *rwlock);
int SDL_UnlockRWLock_generic(SDL_RWLock *rwlock);
#endif /* SDL_THREAD_GENERIC_RWLOCK_SUFFIX */

View File

@ -26,49 +26,49 @@
#ifdef SDL_THREADS_DISABLED
SDL_sem *
SDL_Semaphore *
SDL_CreateSemaphore(Uint32 initial_value)
{
SDL_SetError("SDL not built with thread support");
return (SDL_sem *)0;
return (SDL_Semaphore *)0;
}
void SDL_DestroySemaphore(SDL_sem *sem)
void SDL_DestroySemaphore(SDL_Semaphore *sem)
{
}
int SDL_WaitSemaphoreTimeoutNS(SDL_sem *sem, Sint64 timeoutNS)
int SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
{
return SDL_SetError("SDL not built with thread support");
}
Uint32
SDL_GetSemaphoreValue(SDL_sem *sem)
SDL_GetSemaphoreValue(SDL_Semaphore *sem)
{
return 0;
}
int SDL_PostSemaphore(SDL_sem *sem)
int SDL_PostSemaphore(SDL_Semaphore *sem)
{
return SDL_SetError("SDL not built with thread support");
}
#else
struct SDL_semaphore
struct SDL_Semaphore
{
Uint32 count;
Uint32 waiters_count;
SDL_mutex *count_lock;
SDL_cond *count_nonzero;
SDL_Mutex *count_lock;
SDL_Condition *count_nonzero;
};
SDL_sem *
SDL_Semaphore *
SDL_CreateSemaphore(Uint32 initial_value)
{
SDL_sem *sem;
SDL_Semaphore *sem;
sem = (SDL_sem *)SDL_malloc(sizeof(*sem));
sem = (SDL_Semaphore *)SDL_malloc(sizeof(*sem));
if (sem == NULL) {
SDL_OutOfMemory();
return NULL;
@ -89,7 +89,7 @@ SDL_CreateSemaphore(Uint32 initial_value)
/* WARNING:
You cannot call this function when another thread is using the semaphore.
*/
void SDL_DestroySemaphore(SDL_sem *sem)
void SDL_DestroySemaphore(SDL_Semaphore *sem)
{
if (sem) {
sem->count = 0xFFFFFFFF;
@ -107,7 +107,7 @@ void SDL_DestroySemaphore(SDL_sem *sem)
}
}
int SDL_WaitSemaphoreTimeoutNS(SDL_sem *sem, Sint64 timeoutNS)
int SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
{
int retval;
@ -145,7 +145,7 @@ int SDL_WaitSemaphoreTimeoutNS(SDL_sem *sem, Sint64 timeoutNS)
}
Uint32
SDL_GetSemaphoreValue(SDL_sem *sem)
SDL_GetSemaphoreValue(SDL_Semaphore *sem)
{
Uint32 value;
@ -158,7 +158,7 @@ SDL_GetSemaphoreValue(SDL_sem *sem)
return value;
}
int SDL_PostSemaphore(SDL_sem *sem)
int SDL_PostSemaphore(SDL_Semaphore *sem)
{
if (sem == NULL) {
return SDL_InvalidParamError("sem");

View File

@ -26,16 +26,16 @@
#include "SDL_sysmutex_c.h"
struct SDL_cond
struct SDL_Condition
{
CondVar cond_variable;
};
/* Create a condition variable */
SDL_cond *
SDL_Condition *
SDL_CreateCondition(void)
{
SDL_cond *cond = (SDL_cond *)SDL_malloc(sizeof(SDL_cond));
SDL_Condition *cond = (SDL_Condition *)SDL_malloc(sizeof(SDL_Condition));
if (cond) {
CondVar_Init(&cond->cond_variable);
} else {
@ -45,7 +45,7 @@ SDL_CreateCondition(void)
}
/* Destroy a condition variable */
void SDL_DestroyCondition(SDL_cond *cond)
void SDL_DestroyCondition(SDL_Condition *cond)
{
if (cond) {
SDL_free(cond);
@ -53,7 +53,7 @@ void SDL_DestroyCondition(SDL_cond *cond)
}
/* Restart one of the threads that are waiting on the condition variable */
int SDL_SignalCondition(SDL_cond *cond)
int SDL_SignalCondition(SDL_Condition *cond)
{
if (cond == NULL) {
return SDL_InvalidParamError("cond");
@ -64,7 +64,7 @@ int SDL_SignalCondition(SDL_cond *cond)
}
/* Restart all threads that are waiting on the condition variable */
int SDL_BroadcastCondition(SDL_cond *cond)
int SDL_BroadcastCondition(SDL_Condition *cond)
{
if (cond == NULL) {
return SDL_InvalidParamError("cond");
@ -95,7 +95,7 @@ Thread B:
SDL_SignalCondition(cond);
SDL_UnlockMutex(lock);
*/
int SDL_WaitConditionTimeoutNS(SDL_cond *cond, SDL_mutex *mutex, Sint64 timeoutNS)
int SDL_WaitConditionTimeoutNS(SDL_Condition *cond, SDL_Mutex *mutex, Sint64 timeoutNS)
{
Result res;

View File

@ -27,13 +27,13 @@
#include "SDL_sysmutex_c.h"
/* Create a mutex */
SDL_mutex *
SDL_Mutex *
SDL_CreateMutex(void)
{
SDL_mutex *mutex;
SDL_Mutex *mutex;
/* Allocate mutex memory */
mutex = (SDL_mutex *)SDL_malloc(sizeof(*mutex));
mutex = (SDL_Mutex *)SDL_malloc(sizeof(*mutex));
if (mutex) {
RecursiveLock_Init(&mutex->lock);
} else {
@ -43,7 +43,7 @@ SDL_CreateMutex(void)
}
/* Free the mutex */
void SDL_DestroyMutex(SDL_mutex *mutex)
void SDL_DestroyMutex(SDL_Mutex *mutex)
{
if (mutex) {
SDL_free(mutex);
@ -51,7 +51,7 @@ void SDL_DestroyMutex(SDL_mutex *mutex)
}
/* Lock the mutex */
int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
int SDL_LockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
if (mutex == NULL) {
return 0;
@ -63,7 +63,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn
}
/* try Lock the mutex */
int SDL_TryLockMutex(SDL_mutex *mutex)
int SDL_TryLockMutex(SDL_Mutex *mutex)
{
if (mutex == NULL) {
return 0;
@ -73,7 +73,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
}
/* Unlock the mutex */
int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
int SDL_UnlockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
if (mutex == NULL) {
return 0;

View File

@ -25,7 +25,7 @@
#include <3ds.h>
struct SDL_mutex
struct SDL_Mutex
{
RecursiveLock lock;
};

View File

@ -26,23 +26,23 @@
#include <3ds.h>
int WaitOnSemaphoreFor(SDL_sem *sem, Sint64 timeout);
int WaitOnSemaphoreFor(SDL_Semaphore *sem, Sint64 timeout);
struct SDL_semaphore
struct SDL_Semaphore
{
LightSemaphore semaphore;
};
SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
SDL_Semaphore *SDL_CreateSemaphore(Uint32 initial_value)
{
SDL_sem *sem;
SDL_Semaphore *sem;
if (initial_value > SDL_MAX_SINT16) {
SDL_SetError("Initial semaphore value too high for this platform");
return NULL;
}
sem = (SDL_sem *)SDL_malloc(sizeof(*sem));
sem = (SDL_Semaphore *)SDL_malloc(sizeof(*sem));
if (sem == NULL) {
SDL_OutOfMemory();
return NULL;
@ -56,12 +56,12 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
/* WARNING:
You cannot call this function when another thread is using the semaphore.
*/
void SDL_DestroySemaphore(SDL_sem *sem)
void SDL_DestroySemaphore(SDL_Semaphore *sem)
{
SDL_free(sem);
}
int SDL_WaitSemaphoreTimeoutNS(SDL_sem *sem, Sint64 timeoutNS)
int SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
{
if (sem == NULL) {
return SDL_InvalidParamError("sem");
@ -79,7 +79,7 @@ int SDL_WaitSemaphoreTimeoutNS(SDL_sem *sem, Sint64 timeoutNS)
return 0;
}
int WaitOnSemaphoreFor(SDL_sem *sem, Sint64 timeout)
int WaitOnSemaphoreFor(SDL_Semaphore *sem, Sint64 timeout)
{
Uint64 stop_time = SDL_GetTicksNS() + timeout;
Uint64 current_time = SDL_GetTicksNS();
@ -97,7 +97,7 @@ int WaitOnSemaphoreFor(SDL_sem *sem, Sint64 timeout)
return SDL_MUTEX_TIMEDOUT;
}
Uint32 SDL_GetSemaphoreValue(SDL_sem *sem)
Uint32 SDL_GetSemaphoreValue(SDL_Semaphore *sem)
{
if (sem == NULL) {
SDL_InvalidParamError("sem");
@ -106,7 +106,7 @@ Uint32 SDL_GetSemaphoreValue(SDL_sem *sem)
return sem->semaphore.current_count;
}
int SDL_PostSemaphore(SDL_sem *sem)
int SDL_PostSemaphore(SDL_Semaphore *sem)
{
if (sem == NULL) {
return SDL_InvalidParamError("sem");

View File

@ -26,7 +26,7 @@
#include "SDL_systhread_c.h"
struct SDL_mutex
struct SDL_Mutex
{
TInt handle;
};
@ -39,7 +39,7 @@ static TInt NewMutex(const TDesC &aName, TAny *aPtr1, TAny *)
}
/* Create a mutex */
SDL_mutex *
SDL_Mutex *
SDL_CreateMutex(void)
{
RMutex rmutex;
@ -49,13 +49,13 @@ SDL_CreateMutex(void)
SDL_SetError("Couldn't create mutex.");
return NULL;
}
SDL_mutex *mutex = new /*(ELeave)*/ SDL_mutex;
SDL_Mutex *mutex = new /*(ELeave)*/ SDL_Mutex;
mutex->handle = rmutex.Handle();
return mutex;
}
/* Free the mutex */
void SDL_DestroyMutex(SDL_mutex *mutex)
void SDL_DestroyMutex(SDL_Mutex *mutex)
{
if (mutex) {
RMutex rmutex;
@ -68,7 +68,7 @@ void SDL_DestroyMutex(SDL_mutex *mutex)
}
/* Lock the mutex */
int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
int SDL_LockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
if (mutex == NULL) {
return 0;
@ -84,7 +84,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn
/* Try to lock the mutex */
#if 0
int
SDL_TryLockMutex(SDL_mutex *mutex)
SDL_TryLockMutex(SDL_Mutex *mutex)
{
if (mutex == NULL)
{
@ -97,7 +97,7 @@ SDL_TryLockMutex(SDL_mutex *mutex)
#endif
/* Unlock the mutex */
int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
int SDL_UnlockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
if (mutex == NULL) {
return 0;

View File

@ -27,7 +27,7 @@
/* !!! FIXME: Should this be SDL_MUTEX_TIMEDOUT? */
#define SDL_MUTEX_TIMEOUT -2
struct SDL_semaphore
struct SDL_Semaphore
{
TInt handle;
TInt count;
@ -65,7 +65,7 @@ static TInt NewSema(const TDesC &aName, TAny *aPtr1, TAny *aPtr2)
return ((RSemaphore *)aPtr1)->CreateGlobal(aName, value);
}
static void WaitAll(SDL_sem *sem)
static void WaitAll(SDL_Semaphore *sem)
{
RSemaphore sema;
sema.SetHandle(sem->handle);
@ -75,7 +75,7 @@ static void WaitAll(SDL_sem *sem)
}
}
SDL_sem *
SDL_Semaphore *
SDL_CreateSemaphore(Uint32 initial_value)
{
RSemaphore s;
@ -83,13 +83,13 @@ SDL_CreateSemaphore(Uint32 initial_value)
if (status != KErrNone) {
SDL_SetError("Couldn't create semaphore");
}
SDL_semaphore *sem = new /*(ELeave)*/ SDL_semaphore;
SDL_Semaphore *sem = new /*(ELeave)*/ SDL_Semaphore;
sem->handle = s.Handle();
sem->count = initial_value;
return sem;
}
void SDL_DestroySemaphore(SDL_sem *sem)
void SDL_DestroySemaphore(SDL_Semaphore *sem)
{
if (sem != NULL) {
RSemaphore sema;
@ -101,7 +101,7 @@ void SDL_DestroySemaphore(SDL_sem *sem)
}
}
int SDL_WaitSemaphoreTimeoutNS(SDL_sem *sem, Sint64 timeoutNS)
int SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
{
if (sem == NULL) {
return SDL_InvalidParamError("sem");
@ -140,7 +140,7 @@ int SDL_WaitSemaphoreTimeoutNS(SDL_sem *sem, Sint64 timeoutNS)
}
Uint32
SDL_GetSemaphoreValue(SDL_sem *sem)
SDL_GetSemaphoreValue(SDL_Semaphore *sem)
{
if (sem == NULL) {
SDL_InvalidParamError("sem");
@ -149,7 +149,7 @@ SDL_GetSemaphoreValue(SDL_sem *sem)
return sem->count;
}
int SDL_PostSemaphore(SDL_sem *sem)
int SDL_PostSemaphore(SDL_Semaphore *sem)
{
if (sem == NULL) {
return SDL_InvalidParamError("sem");

View File

@ -30,7 +30,7 @@
#include <kernel.h>
struct SDL_semaphore
struct SDL_Semaphore
{
s32 semid;
};
@ -41,12 +41,12 @@ static void usercb(struct timer_alarm_t *alarm, void *arg)
}
/* Create a semaphore */
SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
SDL_Semaphore *SDL_CreateSemaphore(Uint32 initial_value)
{
SDL_sem *sem;
SDL_Semaphore *sem;
ee_sema_t sema;
sem = (SDL_sem *)SDL_malloc(sizeof(*sem));
sem = (SDL_Semaphore *)SDL_malloc(sizeof(*sem));
if (sem != NULL) {
/* TODO: Figure out the limit on the maximum value. */
sema.init_count = initial_value;
@ -67,7 +67,7 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
}
/* Free the semaphore */
void SDL_DestroySemaphore(SDL_sem *sem)
void SDL_DestroySemaphore(SDL_Semaphore *sem)
{
if (sem != NULL) {
if (sem->semid > 0) {
@ -79,7 +79,7 @@ void SDL_DestroySemaphore(SDL_sem *sem)
}
}
int SDL_WaitSemaphoreTimeoutNS(SDL_sem *sem, Sint64 timeoutNS)
int SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
{
int ret;
struct timer_alarm_t alarm;
@ -110,7 +110,7 @@ int SDL_WaitSemaphoreTimeoutNS(SDL_sem *sem, Sint64 timeoutNS)
}
/* Returns the current count of the semaphore */
Uint32 SDL_GetSemaphoreValue(SDL_sem *sem)
Uint32 SDL_GetSemaphoreValue(SDL_Semaphore *sem)
{
ee_sema_t info;
@ -126,7 +126,7 @@ Uint32 SDL_GetSemaphoreValue(SDL_sem *sem)
return 0;
}
int SDL_PostSemaphore(SDL_sem *sem)
int SDL_PostSemaphore(SDL_Semaphore *sem)
{
int res;

View File

@ -28,22 +28,22 @@
implementation, written by Christopher Tate and Owen Smith. Thanks!
*/
struct SDL_cond
struct SDL_Condition
{
SDL_mutex *lock;
SDL_Mutex *lock;
int waiting;
int signals;
SDL_sem *wait_sem;
SDL_sem *wait_done;
SDL_Semaphore *wait_sem;
SDL_Semaphore *wait_done;
};
/* Create a condition variable */
SDL_cond *
SDL_Condition *
SDL_CreateCondition(void)
{
SDL_cond *cond;
SDL_Condition *cond;
cond = (SDL_cond *)SDL_malloc(sizeof(SDL_cond));
cond = (SDL_Condition *)SDL_malloc(sizeof(SDL_Condition));
if (cond) {
cond->lock = SDL_CreateMutex();
cond->wait_sem = SDL_CreateSemaphore(0);
@ -60,7 +60,7 @@ SDL_CreateCondition(void)
}
/* Destroy a condition variable */
void SDL_DestroyCondition(SDL_cond *cond)
void SDL_DestroyCondition(SDL_Condition *cond)
{
if (cond) {
if (cond->wait_sem) {
@ -77,7 +77,7 @@ void SDL_DestroyCondition(SDL_cond *cond)
}
/* Restart one of the threads that are waiting on the condition variable */
int SDL_SignalCondition(SDL_cond *cond)
int SDL_SignalCondition(SDL_Condition *cond)
{
if (cond == NULL) {
return SDL_InvalidParamError("cond");
@ -100,7 +100,7 @@ int SDL_SignalCondition(SDL_cond *cond)
}
/* Restart all threads that are waiting on the condition variable */
int SDL_BroadcastCondition(SDL_cond *cond)
int SDL_BroadcastCondition(SDL_Condition *cond)
{
if (cond == NULL) {
return SDL_InvalidParamError("cond");
@ -153,7 +153,7 @@ Thread B:
SDL_SignalCondition(cond);
SDL_UnlockMutex(lock);
*/
int SDL_WaitConditionTimeoutNS(SDL_cond *cond, SDL_mutex *mutex, Sint64 timeoutNS)
int SDL_WaitConditionTimeoutNS(SDL_Condition *cond, SDL_Mutex *mutex, Sint64 timeoutNS)
{
int retval;

View File

@ -31,20 +31,20 @@
#define SCE_KERNEL_MUTEX_ATTR_RECURSIVE 0x0200U
struct SDL_mutex
struct SDL_Mutex
{
SceLwMutexWorkarea lock;
};
/* Create a mutex */
SDL_mutex *
SDL_Mutex *
SDL_CreateMutex(void)
{
SDL_mutex *mutex = NULL;
SDL_Mutex *mutex = NULL;
SceInt32 res = 0;
/* Allocate mutex memory */
mutex = (SDL_mutex *)SDL_malloc(sizeof(*mutex));
mutex = (SDL_Mutex *)SDL_malloc(sizeof(*mutex));
if (mutex) {
res = sceKernelCreateLwMutex(
@ -64,7 +64,7 @@ SDL_CreateMutex(void)
}
/* Free the mutex */
void SDL_DestroyMutex(SDL_mutex *mutex)
void SDL_DestroyMutex(SDL_Mutex *mutex)
{
if (mutex) {
sceKernelDeleteLwMutex(&mutex->lock);
@ -73,7 +73,7 @@ void SDL_DestroyMutex(SDL_mutex *mutex)
}
/* Lock the mutex */
int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
int SDL_LockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
#ifdef SDL_THREADS_DISABLED
return 0;
@ -94,7 +94,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn
}
/* Try to lock the mutex */
int SDL_TryLockMutex(SDL_mutex *mutex)
int SDL_TryLockMutex(SDL_Mutex *mutex)
{
#ifdef SDL_THREADS_DISABLED
return 0;
@ -123,7 +123,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
}
/* Unlock the mutex */
int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
int SDL_UnlockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
#ifdef SDL_THREADS_DISABLED
return 0;

View File

@ -30,17 +30,17 @@
#include <pspthreadman.h>
#include <pspkerror.h>
struct SDL_semaphore
struct SDL_Semaphore
{
SceUID semid;
};
/* Create a semaphore */
SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
SDL_Semaphore *SDL_CreateSemaphore(Uint32 initial_value)
{
SDL_sem *sem;
SDL_Semaphore *sem;
sem = (SDL_sem *)SDL_malloc(sizeof(*sem));
sem = (SDL_Semaphore *)SDL_malloc(sizeof(*sem));
if (sem != NULL) {
/* TODO: Figure out the limit on the maximum value. */
sem->semid = sceKernelCreateSema("SDL sema", 0, initial_value, 255, NULL);
@ -57,7 +57,7 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
}
/* Free the semaphore */
void SDL_DestroySemaphore(SDL_sem *sem)
void SDL_DestroySemaphore(SDL_Semaphore *sem)
{
if (sem != NULL) {
if (sem->semid > 0) {
@ -73,7 +73,7 @@ void SDL_DestroySemaphore(SDL_sem *sem)
* If the timeout is 0 then just poll the semaphore; if it's SDL_MUTEX_MAXWAIT, pass
* NULL to sceKernelWaitSema() so that it waits indefinitely; and if the timeout
* is specified, convert it to microseconds. */
int SDL_WaitSemaphoreTimeoutNS(SDL_sem *sem, Sint64 timeoutNS)
int SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
{
SceUInt timeoutUS;
SceUInt *pTimeout;
@ -110,7 +110,7 @@ int SDL_WaitSemaphoreTimeoutNS(SDL_sem *sem, Sint64 timeoutNS)
}
/* Returns the current count of the semaphore */
Uint32 SDL_GetSemaphoreValue(SDL_sem *sem)
Uint32 SDL_GetSemaphoreValue(SDL_Semaphore *sem)
{
SceKernelSemaInfo info;
@ -126,7 +126,7 @@ Uint32 SDL_GetSemaphoreValue(SDL_sem *sem)
return 0;
}
int SDL_PostSemaphore(SDL_sem *sem)
int SDL_PostSemaphore(SDL_Semaphore *sem)
{
int res;

View File

@ -28,18 +28,18 @@
#include "SDL_sysmutex_c.h"
struct SDL_cond
struct SDL_Condition
{
pthread_cond_t cond;
};
/* Create a condition variable */
SDL_cond *
SDL_Condition *
SDL_CreateCondition(void)
{
SDL_cond *cond;
SDL_Condition *cond;
cond = (SDL_cond *)SDL_malloc(sizeof(SDL_cond));
cond = (SDL_Condition *)SDL_malloc(sizeof(SDL_Condition));
if (cond) {
if (pthread_cond_init(&cond->cond, NULL) != 0) {
SDL_SetError("pthread_cond_init() failed");
@ -51,7 +51,7 @@ SDL_CreateCondition(void)
}
/* Destroy a condition variable */
void SDL_DestroyCondition(SDL_cond *cond)
void SDL_DestroyCondition(SDL_Condition *cond)
{
if (cond) {
pthread_cond_destroy(&cond->cond);
@ -60,7 +60,7 @@ void SDL_DestroyCondition(SDL_cond *cond)
}
/* Restart one of the threads that are waiting on the condition variable */
int SDL_SignalCondition(SDL_cond *cond)
int SDL_SignalCondition(SDL_Condition *cond)
{
int retval;
@ -76,7 +76,7 @@ int SDL_SignalCondition(SDL_cond *cond)
}
/* Restart all threads that are waiting on the condition variable */
int SDL_BroadcastCondition(SDL_cond *cond)
int SDL_BroadcastCondition(SDL_Condition *cond)
{
int retval;
@ -91,7 +91,7 @@ int SDL_BroadcastCondition(SDL_cond *cond)
return retval;
}
int SDL_WaitConditionTimeoutNS(SDL_cond *cond, SDL_mutex *mutex, Sint64 timeoutNS)
int SDL_WaitConditionTimeoutNS(SDL_Condition *cond, SDL_Mutex *mutex, Sint64 timeoutNS)
{
int retval;
#ifndef HAVE_CLOCK_GETTIME

View File

@ -25,14 +25,14 @@
#include "SDL_sysmutex_c.h"
SDL_mutex *
SDL_Mutex *
SDL_CreateMutex(void)
{
SDL_mutex *mutex;
SDL_Mutex *mutex;
pthread_mutexattr_t attr;
/* Allocate the structure */
mutex = (SDL_mutex *)SDL_calloc(1, sizeof(*mutex));
mutex = (SDL_Mutex *)SDL_calloc(1, sizeof(*mutex));
if (mutex) {
pthread_mutexattr_init(&attr);
#ifdef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
@ -53,7 +53,7 @@ SDL_CreateMutex(void)
return mutex;
}
void SDL_DestroyMutex(SDL_mutex *mutex)
void SDL_DestroyMutex(SDL_Mutex *mutex)
{
if (mutex) {
pthread_mutex_destroy(&mutex->id);
@ -62,7 +62,7 @@ void SDL_DestroyMutex(SDL_mutex *mutex)
}
/* Lock the mutex */
int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
int SDL_LockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
#ifdef FAKE_RECURSIVE_MUTEX
pthread_t this_thread;
@ -96,7 +96,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn
return 0;
}
int SDL_TryLockMutex(SDL_mutex *mutex)
int SDL_TryLockMutex(SDL_Mutex *mutex)
{
int retval;
int result;
@ -141,7 +141,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
return retval;
}
int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
int SDL_UnlockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
if (mutex == NULL) {
return 0;

View File

@ -28,7 +28,7 @@
#define FAKE_RECURSIVE_MUTEX
#endif
struct SDL_mutex
struct SDL_Mutex
{
pthread_mutex_t id;
#ifdef FAKE_RECURSIVE_MUTEX

View File

@ -23,19 +23,19 @@
#include <errno.h>
#include <pthread.h>
struct SDL_rwlock
struct SDL_RWLock
{
pthread_rwlock_t id;
};
SDL_rwlock *
SDL_RWLock *
SDL_CreateRWLock(void)
{
SDL_rwlock *rwlock;
SDL_RWLock *rwlock;
/* Allocate the structure */
rwlock = (SDL_rwlock *)SDL_calloc(1, sizeof(*rwlock));
rwlock = (SDL_RWLock *)SDL_calloc(1, sizeof(*rwlock));
if (rwlock) {
if (pthread_rwlock_init(&rwlock->id, NULL) != 0) {
SDL_SetError("pthread_rwlock_init() failed");
@ -48,7 +48,7 @@ SDL_CreateRWLock(void)
return rwlock;
}
void SDL_DestroyRWLock(SDL_rwlock *rwlock)
void SDL_DestroyRWLock(SDL_RWLock *rwlock)
{
if (rwlock) {
pthread_rwlock_destroy(&rwlock->id);
@ -56,7 +56,7 @@ void SDL_DestroyRWLock(SDL_rwlock *rwlock)
}
}
int SDL_LockRWLockForReading(SDL_rwlock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
int SDL_LockRWLockForReading(SDL_RWLock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
if (rwlock == NULL) {
return SDL_InvalidParamError("rwlock");
@ -66,7 +66,7 @@ int SDL_LockRWLockForReading(SDL_rwlock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /
return 0;
}
int SDL_LockRWLockForWriting(SDL_rwlock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
int SDL_LockRWLockForWriting(SDL_RWLock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
if (rwlock == NULL) {
return SDL_InvalidParamError("rwlock");
@ -76,7 +76,7 @@ int SDL_LockRWLockForWriting(SDL_rwlock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /
return 0;
}
int SDL_TryLockRWLockForReading(SDL_rwlock *rwlock)
int SDL_TryLockRWLockForReading(SDL_RWLock *rwlock)
{
int retval = 0;
@ -95,7 +95,7 @@ int SDL_TryLockRWLockForReading(SDL_rwlock *rwlock)
return retval;
}
int SDL_TryLockRWLockForWriting(SDL_rwlock *rwlock)
int SDL_TryLockRWLockForWriting(SDL_RWLock *rwlock)
{
int retval = 0;
@ -115,7 +115,7 @@ int SDL_TryLockRWLockForWriting(SDL_rwlock *rwlock)
return retval;
}
int SDL_UnlockRWLock(SDL_rwlock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
int SDL_UnlockRWLock(SDL_RWLock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
if (rwlock == NULL) {
return SDL_InvalidParamError("rwlock");

View File

@ -33,16 +33,16 @@
#include "../generic/SDL_syssem.c"
#else
struct SDL_semaphore
struct SDL_Semaphore
{
sem_t sem;
};
/* Create a semaphore, initialized with value */
SDL_sem *
SDL_Semaphore *
SDL_CreateSemaphore(Uint32 initial_value)
{
SDL_sem *sem = (SDL_sem *)SDL_malloc(sizeof(SDL_sem));
SDL_Semaphore *sem = (SDL_Semaphore *)SDL_malloc(sizeof(SDL_Semaphore));
if (sem != NULL) {
if (sem_init(&sem->sem, 0, initial_value) < 0) {
SDL_SetError("sem_init() failed");
@ -55,7 +55,7 @@ SDL_CreateSemaphore(Uint32 initial_value)
return sem;
}
void SDL_DestroySemaphore(SDL_sem *sem)
void SDL_DestroySemaphore(SDL_Semaphore *sem)
{
if (sem != NULL) {
sem_destroy(&sem->sem);
@ -63,7 +63,7 @@ void SDL_DestroySemaphore(SDL_sem *sem)
}
}
int SDL_WaitSemaphoreTimeoutNS(SDL_sem *sem, Sint64 timeoutNS)
int SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
{
int retval = 0;
#ifdef HAVE_SEM_TIMEDWAIT
@ -150,7 +150,7 @@ int SDL_WaitSemaphoreTimeoutNS(SDL_sem *sem, Sint64 timeoutNS)
}
Uint32
SDL_GetSemaphoreValue(SDL_sem *sem)
SDL_GetSemaphoreValue(SDL_Semaphore *sem)
{
int ret = 0;
@ -166,7 +166,7 @@ SDL_GetSemaphoreValue(SDL_sem *sem)
return (Uint32)ret;
}
int SDL_PostSemaphore(SDL_sem *sem)
int SDL_PostSemaphore(SDL_Semaphore *sem)
{
int retval;

View File

@ -30,18 +30,18 @@ extern "C" {
#include "SDL_sysmutex_c.h"
struct SDL_cond
struct SDL_Condition
{
std::condition_variable_any cpp_cond;
};
/* Create a condition variable */
extern "C" SDL_cond *
extern "C" SDL_Condition *
SDL_CreateCondition(void)
{
/* Allocate and initialize the condition variable */
try {
SDL_cond *cond = new SDL_cond;
SDL_Condition *cond = new SDL_Condition;
return cond;
} catch (std::system_error &ex) {
SDL_SetError("unable to create a C++ condition variable: code=%d; %s", ex.code(), ex.what());
@ -54,7 +54,7 @@ SDL_CreateCondition(void)
/* Destroy a condition variable */
extern "C" void
SDL_DestroyCondition(SDL_cond *cond)
SDL_DestroyCondition(SDL_Condition *cond)
{
if (cond != NULL) {
delete cond;
@ -63,7 +63,7 @@ SDL_DestroyCondition(SDL_cond *cond)
/* Restart one of the threads that are waiting on the condition variable */
extern "C" int
SDL_SignalCondition(SDL_cond *cond)
SDL_SignalCondition(SDL_Condition *cond)
{
if (cond == NULL) {
return SDL_InvalidParamError("cond");
@ -75,7 +75,7 @@ SDL_SignalCondition(SDL_cond *cond)
/* Restart all threads that are waiting on the condition variable */
extern "C" int
SDL_BroadcastCondition(SDL_cond *cond)
SDL_BroadcastCondition(SDL_Condition *cond)
{
if (cond == NULL) {
return SDL_InvalidParamError("cond");
@ -107,7 +107,7 @@ Thread B:
SDL_UnlockMutex(lock);
*/
extern "C" int
SDL_WaitConditionTimeoutNS(SDL_cond *cond, SDL_mutex *mutex, Sint64 timeoutNS)
SDL_WaitConditionTimeoutNS(SDL_Condition *cond, SDL_Mutex *mutex, Sint64 timeoutNS)
{
if (cond == NULL) {
return SDL_InvalidParamError("cond");

View File

@ -30,12 +30,12 @@ extern "C" {
#include <Windows.h>
/* Create a mutex */
extern "C" SDL_mutex *
extern "C" SDL_Mutex *
SDL_CreateMutex(void)
{
/* Allocate and initialize the mutex */
try {
SDL_mutex *mutex = new SDL_mutex;
SDL_Mutex *mutex = new SDL_Mutex;
return mutex;
} catch (std::system_error &ex) {
SDL_SetError("unable to create a C++ mutex: code=%d; %s", ex.code(), ex.what());
@ -48,7 +48,7 @@ SDL_CreateMutex(void)
/* Free the mutex */
extern "C" void
SDL_DestroyMutex(SDL_mutex *mutex)
SDL_DestroyMutex(SDL_Mutex *mutex)
{
if (mutex != NULL) {
delete mutex;
@ -57,7 +57,7 @@ SDL_DestroyMutex(SDL_mutex *mutex)
/* Lock the mutex */
extern "C" int
SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
SDL_LockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
if (mutex == NULL) {
return 0;
@ -72,7 +72,7 @@ SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't k
}
/* TryLock the mutex */
int SDL_TryLockMutex(SDL_mutex *mutex)
int SDL_TryLockMutex(SDL_Mutex *mutex)
{
int retval = 0;
@ -88,7 +88,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
/* Unlock the mutex */
extern "C" int
SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
SDL_UnlockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
if (mutex == NULL) {
return 0;

View File

@ -22,7 +22,7 @@
#include <mutex>
struct SDL_mutex
struct SDL_Mutex
{
std::recursive_mutex cpp_mutex;
};

View File

@ -24,18 +24,18 @@
#include <system_error>
#include <Windows.h>
struct SDL_rwlock
struct SDL_RWLock
{
std::shared_mutex cpp_mutex;
SDL_threadID write_owner;
};
/* Create a rwlock */
extern "C" SDL_rwlock *SDL_CreateRWLock(void)
extern "C" SDL_RWLock *SDL_CreateRWLock(void)
{
/* Allocate and initialize the rwlock */
try {
SDL_rwlock *rwlock = new SDL_rwlock;
SDL_RWLock *rwlock = new SDL_RWLock;
return rwlock;
} catch (std::system_error &ex) {
SDL_SetError("unable to create a C++ rwlock: code=%d; %s", ex.code(), ex.what());
@ -47,7 +47,7 @@ extern "C" SDL_rwlock *SDL_CreateRWLock(void)
}
/* Free the rwlock */
extern "C" void SDL_DestroyRWLock(SDL_rwlock *rwlock)
extern "C" void SDL_DestroyRWLock(SDL_RWLock *rwlock)
{
if (rwlock != NULL) {
delete rwlock;
@ -55,7 +55,7 @@ extern "C" void SDL_DestroyRWLock(SDL_rwlock *rwlock)
}
/* Lock the rwlock */
extern "C" int SDL_LockRWLockForReading(SDL_rwlock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
extern "C" int SDL_LockRWLockForReading(SDL_RWLock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
if (!rwlock) {
return SDL_InvalidParamError("rwlock");
@ -70,7 +70,7 @@ extern "C" int SDL_LockRWLockForReading(SDL_rwlock *rwlock) SDL_NO_THREAD_SAFETY
}
/* Lock the rwlock for writing */
extern "C" int SDL_LockRWLockForWriting(SDL_rwlock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
extern "C" int SDL_LockRWLockForWriting(SDL_RWLock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
if (!rwlock) {
return SDL_InvalidParamError("rwlock");
@ -86,7 +86,7 @@ extern "C" int SDL_LockRWLockForWriting(SDL_rwlock *rwlock) SDL_NO_THREAD_SAFETY
}
/* TryLock the rwlock for reading */
int SDL_TryLockRWLockForReading(SDL_rwlock *rwlock)
int SDL_TryLockRWLockForReading(SDL_RWLock *rwlock)
{
int retval = 0;
@ -99,7 +99,7 @@ int SDL_TryLockRWLockForReading(SDL_rwlock *rwlock)
}
/* TryLock the rwlock for writing */
int SDL_TryLockRWLockForWriting(SDL_rwlock *rwlock)
int SDL_TryLockRWLockForWriting(SDL_RWLock *rwlock)
{
int retval = 0;
@ -115,7 +115,7 @@ int SDL_TryLockRWLockForWriting(SDL_rwlock *rwlock)
/* Unlock the rwlock */
extern "C" int
SDL_UnlockRWLock(SDL_rwlock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
SDL_UnlockRWLock(SDL_RWLock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
if (!rwlock) {
return SDL_InvalidParamError("rwlock");

View File

@ -28,22 +28,22 @@
implementation, written by Christopher Tate and Owen Smith. Thanks!
*/
struct SDL_cond
struct SDL_Condition
{
SDL_mutex *lock;
SDL_Mutex *lock;
int waiting;
int signals;
SDL_sem *wait_sem;
SDL_sem *wait_done;
SDL_Semaphore *wait_sem;
SDL_Semaphore *wait_done;
};
/* Create a condition variable */
SDL_cond *
SDL_Condition *
SDL_CreateCondition(void)
{
SDL_cond *cond;
SDL_Condition *cond;
cond = (SDL_cond *)SDL_malloc(sizeof(SDL_cond));
cond = (SDL_Condition *)SDL_malloc(sizeof(SDL_Condition));
if (cond != NULL) {
cond->lock = SDL_CreateMutex();
cond->wait_sem = SDL_CreateSemaphore(0);
@ -60,7 +60,7 @@ SDL_CreateCondition(void)
}
/* Destroy a condition variable */
void SDL_DestroyCondition(SDL_cond *cond)
void SDL_DestroyCondition(SDL_Condition *cond)
{
if (cond != NULL) {
if (cond->wait_sem) {
@ -77,7 +77,7 @@ void SDL_DestroyCondition(SDL_cond *cond)
}
/* Restart one of the threads that are waiting on the condition variable */
int SDL_SignalCondition(SDL_cond *cond)
int SDL_SignalCondition(SDL_Condition *cond)
{
if (cond == NULL) {
return SDL_InvalidParamError("cond");
@ -100,7 +100,7 @@ int SDL_SignalCondition(SDL_cond *cond)
}
/* Restart all threads that are waiting on the condition variable */
int SDL_BroadcastCondition(SDL_cond *cond)
int SDL_BroadcastCondition(SDL_Condition *cond)
{
if (cond == NULL) {
return SDL_InvalidParamError("cond");
@ -153,7 +153,7 @@ Thread B:
SDL_SignalCondition(cond);
SDL_UnlockMutex(lock);
*/
int SDL_WaitConditionTimeoutNS(SDL_cond *cond, SDL_mutex *mutex, Sint64 timeoutNS)
int SDL_WaitConditionTimeoutNS(SDL_Condition *cond, SDL_Mutex *mutex, Sint64 timeoutNS)
{
int retval;

View File

@ -27,20 +27,20 @@
#include <psp2/kernel/threadmgr.h>
#include <psp2/kernel/error.h>
struct SDL_mutex
struct SDL_Mutex
{
SceKernelLwMutexWork lock;
};
/* Create a mutex */
SDL_mutex *
SDL_Mutex *
SDL_CreateMutex(void)
{
SDL_mutex *mutex = NULL;
SDL_Mutex *mutex = NULL;
SceInt32 res = 0;
/* Allocate mutex memory */
mutex = (SDL_mutex *)SDL_malloc(sizeof(*mutex));
mutex = (SDL_Mutex *)SDL_malloc(sizeof(*mutex));
if (mutex != NULL) {
res = sceKernelCreateLwMutex(
@ -60,7 +60,7 @@ SDL_CreateMutex(void)
}
/* Free the mutex */
void SDL_DestroyMutex(SDL_mutex *mutex)
void SDL_DestroyMutex(SDL_Mutex *mutex)
{
if (mutex != NULL) {
sceKernelDeleteLwMutex(&mutex->lock);
@ -69,7 +69,7 @@ void SDL_DestroyMutex(SDL_mutex *mutex)
}
/* Lock the mutex */
int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
int SDL_LockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
#ifdef SDL_THREADS_DISABLED
return 0;
@ -90,7 +90,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn
}
/* Try to lock the mutex */
int SDL_TryLockMutex(SDL_mutex *mutex)
int SDL_TryLockMutex(SDL_Mutex *mutex)
{
#ifdef SDL_THREADS_DISABLED
return 0;
@ -119,7 +119,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
}
/* Unlock the mutex */
int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
int SDL_UnlockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
#ifdef SDL_THREADS_DISABLED
return 0;

View File

@ -31,17 +31,17 @@
#include <psp2/kernel/error.h>
#include <psp2/kernel/threadmgr.h>
struct SDL_semaphore
struct SDL_Semaphore
{
SceUID semid;
};
/* Create a semaphore */
SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
SDL_Semaphore *SDL_CreateSemaphore(Uint32 initial_value)
{
SDL_sem *sem;
SDL_Semaphore *sem;
sem = (SDL_sem *)SDL_malloc(sizeof(*sem));
sem = (SDL_Semaphore *)SDL_malloc(sizeof(*sem));
if (sem != NULL) {
/* TODO: Figure out the limit on the maximum value. */
sem->semid = sceKernelCreateSema("SDL sema", 0, initial_value, 255, NULL);
@ -58,7 +58,7 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
}
/* Free the semaphore */
void SDL_DestroySemaphore(SDL_sem *sem)
void SDL_DestroySemaphore(SDL_Semaphore *sem)
{
if (sem != NULL) {
if (sem->semid > 0) {
@ -74,7 +74,7 @@ void SDL_DestroySemaphore(SDL_sem *sem)
* If the timeout is 0 then just poll the semaphore; if it's SDL_MUTEX_MAXWAIT, pass
* NULL to sceKernelWaitSema() so that it waits indefinitely; and if the timeout
* is specified, convert it to microseconds. */
int SDL_WaitSemaphoreTimeoutNS(SDL_sem *sem, Sint64 timeoutNS)
int SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
{
SceUInt timeoutUS;
SceUInt *pTimeout;
@ -111,7 +111,7 @@ int SDL_WaitSemaphoreTimeoutNS(SDL_sem *sem, Sint64 timeoutNS)
}
/* Returns the current count of the semaphore */
Uint32 SDL_GetSemaphoreValue(SDL_sem *sem)
Uint32 SDL_GetSemaphoreValue(SDL_Semaphore *sem)
{
SceKernelSemaInfo info;
info.size = sizeof(info);
@ -128,7 +128,7 @@ Uint32 SDL_GetSemaphoreValue(SDL_sem *sem)
return 0;
}
int SDL_PostSemaphore(SDL_sem *sem)
int SDL_PostSemaphore(SDL_Semaphore *sem)
{
int res;

View File

@ -23,11 +23,11 @@
#include "../generic/SDL_syscond_c.h"
#include "SDL_sysmutex_c.h"
typedef SDL_cond *(*pfnSDL_CreateCondition)(void);
typedef void (*pfnSDL_DestroyCondition)(SDL_cond *);
typedef int (*pfnSDL_SignalCondition)(SDL_cond *);
typedef int (*pfnSDL_BroadcastCondition)(SDL_cond *);
typedef int (*pfnSDL_WaitConditionTimeoutNS)(SDL_cond *, SDL_mutex *, Sint64);
typedef SDL_Condition *(*pfnSDL_CreateCondition)(void);
typedef void (*pfnSDL_DestroyCondition)(SDL_Condition *);
typedef int (*pfnSDL_SignalCondition)(SDL_Condition *);
typedef int (*pfnSDL_BroadcastCondition)(SDL_Condition *);
typedef int (*pfnSDL_WaitConditionTimeoutNS)(SDL_Condition *, SDL_Mutex *, Sint64);
typedef struct SDL_cond_impl_t
{
@ -78,7 +78,7 @@ typedef struct SDL_cond_cv
CONDITION_VARIABLE cond;
} SDL_cond_cv;
static SDL_cond *SDL_CreateCondition_cv(void)
static SDL_Condition *SDL_CreateCondition_cv(void)
{
SDL_cond_cv *cond;
@ -88,10 +88,10 @@ static SDL_cond *SDL_CreateCondition_cv(void)
SDL_OutOfMemory();
}
return (SDL_cond *)cond;
return (SDL_Condition *)cond;
}
static void SDL_DestroyCondition_cv(SDL_cond *cond)
static void SDL_DestroyCondition_cv(SDL_Condition *cond)
{
if (cond != NULL) {
/* There are no kernel allocated resources */
@ -99,7 +99,7 @@ static void SDL_DestroyCondition_cv(SDL_cond *cond)
}
}
static int SDL_SignalCondition_cv(SDL_cond *_cond)
static int SDL_SignalCondition_cv(SDL_Condition *_cond)
{
SDL_cond_cv *cond = (SDL_cond_cv *)_cond;
if (cond == NULL) {
@ -111,7 +111,7 @@ static int SDL_SignalCondition_cv(SDL_cond *_cond)
return 0;
}
static int SDL_BroadcastCondition_cv(SDL_cond *_cond)
static int SDL_BroadcastCondition_cv(SDL_Condition *_cond)
{
SDL_cond_cv *cond = (SDL_cond_cv *)_cond;
if (cond == NULL) {
@ -123,7 +123,7 @@ static int SDL_BroadcastCondition_cv(SDL_cond *_cond)
return 0;
}
static int SDL_WaitConditionTimeoutNS_cv(SDL_cond *_cond, SDL_mutex *_mutex, Sint64 timeoutNS)
static int SDL_WaitConditionTimeoutNS_cv(SDL_Condition *_cond, SDL_Mutex *_mutex, Sint64 timeoutNS)
{
SDL_cond_cv *cond = (SDL_cond_cv *)_cond;
DWORD timeout;
@ -196,7 +196,7 @@ static const SDL_cond_impl_t SDL_cond_impl_cv = {
#ifndef __WINRT__
/* Generic Condition Variable implementation using SDL_mutex and SDL_sem */
/* Generic Condition Variable implementation using SDL_Mutex and SDL_Semaphore */
static const SDL_cond_impl_t SDL_cond_impl_generic = {
&SDL_CreateCondition_generic,
&SDL_DestroyCondition_generic,
@ -206,7 +206,7 @@ static const SDL_cond_impl_t SDL_cond_impl_generic = {
};
#endif
SDL_cond *
SDL_Condition *
SDL_CreateCondition(void)
{
if (SDL_cond_impl_active.Create == NULL) {
@ -214,7 +214,7 @@ SDL_CreateCondition(void)
if (SDL_mutex_impl_active.Type == SDL_MUTEX_INVALID) {
/* The mutex implementation isn't decided yet, trigger it */
SDL_mutex *mutex = SDL_CreateMutex();
SDL_Mutex *mutex = SDL_CreateMutex();
if (mutex == NULL) {
return NULL;
}
@ -249,22 +249,22 @@ SDL_CreateCondition(void)
return SDL_cond_impl_active.Create();
}
void SDL_DestroyCondition(SDL_cond *cond)
void SDL_DestroyCondition(SDL_Condition *cond)
{
SDL_cond_impl_active.Destroy(cond);
}
int SDL_SignalCondition(SDL_cond *cond)
int SDL_SignalCondition(SDL_Condition *cond)
{
return SDL_cond_impl_active.Signal(cond);
}
int SDL_BroadcastCondition(SDL_cond *cond)
int SDL_BroadcastCondition(SDL_Condition *cond)
{
return SDL_cond_impl_active.Broadcast(cond);
}
int SDL_WaitConditionTimeoutNS(SDL_cond *cond, SDL_mutex *mutex, Sint64 timeoutNS)
int SDL_WaitConditionTimeoutNS(SDL_Condition *cond, SDL_Mutex *mutex, Sint64 timeoutNS)
{
return SDL_cond_impl_active.WaitTimeoutNS(cond, mutex, timeoutNS);
}

View File

@ -56,7 +56,7 @@ static pfnAcquireSRWLockExclusive pAcquireSRWLockExclusive = NULL;
static pfnTryAcquireSRWLockExclusive pTryAcquireSRWLockExclusive = NULL;
#endif
static SDL_mutex *SDL_CreateMutex_srw(void)
static SDL_Mutex *SDL_CreateMutex_srw(void)
{
SDL_mutex_srw *mutex;
@ -67,16 +67,16 @@ static SDL_mutex *SDL_CreateMutex_srw(void)
pInitializeSRWLock(&mutex->srw);
return (SDL_mutex *)mutex;
return (SDL_Mutex *)mutex;
}
static void SDL_DestroyMutex_srw(SDL_mutex *mutex)
static void SDL_DestroyMutex_srw(SDL_Mutex *mutex)
{
/* There are no kernel allocated resources */
SDL_free(mutex);
}
static int SDL_LockMutex_srw(SDL_mutex *_mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
static int SDL_LockMutex_srw(SDL_Mutex *_mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
SDL_mutex_srw *mutex = (SDL_mutex_srw *)_mutex;
DWORD this_thread;
@ -97,7 +97,7 @@ static int SDL_LockMutex_srw(SDL_mutex *_mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /*
return 0;
}
static int SDL_TryLockMutex_srw(SDL_mutex *_mutex)
static int SDL_TryLockMutex_srw(SDL_Mutex *_mutex)
{
SDL_mutex_srw *mutex = (SDL_mutex_srw *)_mutex;
DWORD this_thread;
@ -118,7 +118,7 @@ static int SDL_TryLockMutex_srw(SDL_mutex *_mutex)
return retval;
}
static int SDL_UnlockMutex_srw(SDL_mutex *_mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
static int SDL_UnlockMutex_srw(SDL_Mutex *_mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
SDL_mutex_srw *mutex = (SDL_mutex_srw *)_mutex;
@ -148,7 +148,7 @@ static const SDL_mutex_impl_t SDL_mutex_impl_srw = {
*/
/* Create a mutex */
static SDL_mutex *SDL_CreateMutex_cs(void)
static SDL_Mutex *SDL_CreateMutex_cs(void)
{
SDL_mutex_cs *mutex;
@ -165,11 +165,11 @@ static SDL_mutex *SDL_CreateMutex_cs(void)
} else {
SDL_OutOfMemory();
}
return (SDL_mutex *)mutex;
return (SDL_Mutex *)mutex;
}
/* Free the mutex */
static void SDL_DestroyMutex_cs(SDL_mutex *mutex_)
static void SDL_DestroyMutex_cs(SDL_Mutex *mutex_)
{
SDL_mutex_cs *mutex = (SDL_mutex_cs *)mutex_;
@ -178,7 +178,7 @@ static void SDL_DestroyMutex_cs(SDL_mutex *mutex_)
}
/* Lock the mutex */
static int SDL_LockMutex_cs(SDL_mutex *mutex_) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
static int SDL_LockMutex_cs(SDL_Mutex *mutex_) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
SDL_mutex_cs *mutex = (SDL_mutex_cs *)mutex_;
@ -187,7 +187,7 @@ static int SDL_LockMutex_cs(SDL_mutex *mutex_) SDL_NO_THREAD_SAFETY_ANALYSIS /*
}
/* TryLock the mutex */
static int SDL_TryLockMutex_cs(SDL_mutex *mutex_)
static int SDL_TryLockMutex_cs(SDL_Mutex *mutex_)
{
SDL_mutex_cs *mutex = (SDL_mutex_cs *)mutex_;
int retval = 0;
@ -199,7 +199,7 @@ static int SDL_TryLockMutex_cs(SDL_mutex *mutex_)
}
/* Unlock the mutex */
static int SDL_UnlockMutex_cs(SDL_mutex *mutex_) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
static int SDL_UnlockMutex_cs(SDL_Mutex *mutex_) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
SDL_mutex_cs *mutex = (SDL_mutex_cs *)mutex_;
@ -220,7 +220,7 @@ static const SDL_mutex_impl_t SDL_mutex_impl_cs = {
* Runtime selection and redirection
*/
SDL_mutex *
SDL_Mutex *
SDL_CreateMutex(void)
{
if (SDL_mutex_impl_active.Create == NULL) {
@ -254,14 +254,14 @@ SDL_CreateMutex(void)
return SDL_mutex_impl_active.Create();
}
void SDL_DestroyMutex(SDL_mutex *mutex)
void SDL_DestroyMutex(SDL_Mutex *mutex)
{
if (mutex) {
SDL_mutex_impl_active.Destroy(mutex);
}
}
int SDL_LockMutex(SDL_mutex *mutex)
int SDL_LockMutex(SDL_Mutex *mutex)
{
if (mutex == NULL) {
return 0;
@ -270,7 +270,7 @@ int SDL_LockMutex(SDL_mutex *mutex)
return SDL_mutex_impl_active.Lock(mutex);
}
int SDL_TryLockMutex(SDL_mutex *mutex)
int SDL_TryLockMutex(SDL_Mutex *mutex)
{
if (mutex == NULL) {
return 0;
@ -279,7 +279,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
return SDL_mutex_impl_active.TryLock(mutex);
}
int SDL_UnlockMutex(SDL_mutex *mutex)
int SDL_UnlockMutex(SDL_Mutex *mutex)
{
if (mutex == NULL) {
return 0;

View File

@ -22,11 +22,11 @@
#include "../../core/windows/SDL_windows.h"
typedef SDL_mutex *(*pfnSDL_CreateMutex)(void);
typedef int (*pfnSDL_LockMutex)(SDL_mutex *);
typedef int (*pfnSDL_TryLockMutex)(SDL_mutex *);
typedef int (*pfnSDL_UnlockMutex)(SDL_mutex *);
typedef void (*pfnSDL_DestroyMutex)(SDL_mutex *);
typedef SDL_Mutex *(*pfnSDL_CreateMutex)(void);
typedef int (*pfnSDL_LockMutex)(SDL_Mutex *);
typedef int (*pfnSDL_TryLockMutex)(SDL_Mutex *);
typedef int (*pfnSDL_UnlockMutex)(SDL_Mutex *);
typedef void (*pfnSDL_DestroyMutex)(SDL_Mutex *);
typedef enum
{
@ -42,7 +42,7 @@ typedef struct SDL_mutex_impl_t
pfnSDL_LockMutex Lock;
pfnSDL_TryLockMutex TryLock;
pfnSDL_UnlockMutex Unlock;
/* Needed by SDL_cond: */
/* Needed by SDL_Condition: */
SDL_MutexType Type;
} SDL_mutex_impl_t;

View File

@ -55,13 +55,13 @@ static pfnAcquireSRWLockExclusive pAcquireSRWLockExclusive = NULL;
static pfnTryAcquireSRWLockExclusive pTryAcquireSRWLockExclusive = NULL;
#endif
typedef SDL_rwlock *(*pfnSDL_CreateRWLock)(void);
typedef void (*pfnSDL_DestroyRWLock)(SDL_rwlock *);
typedef int (*pfnSDL_LockRWLockForReading)(SDL_rwlock *);
typedef int (*pfnSDL_LockRWLockForWriting)(SDL_rwlock *);
typedef int (*pfnSDL_TryLockRWLockForReading)(SDL_rwlock *);
typedef int (*pfnSDL_TryLockRWLockForWriting)(SDL_rwlock *);
typedef int (*pfnSDL_UnlockRWLock)(SDL_rwlock *);
typedef SDL_RWLock *(*pfnSDL_CreateRWLock)(void);
typedef void (*pfnSDL_DestroyRWLock)(SDL_RWLock *);
typedef int (*pfnSDL_LockRWLockForReading)(SDL_RWLock *);
typedef int (*pfnSDL_LockRWLockForWriting)(SDL_RWLock *);
typedef int (*pfnSDL_TryLockRWLockForReading)(SDL_RWLock *);
typedef int (*pfnSDL_TryLockRWLockForWriting)(SDL_RWLock *);
typedef int (*pfnSDL_UnlockRWLock)(SDL_RWLock *);
typedef struct SDL_rwlock_impl_t
{
@ -85,17 +85,17 @@ typedef struct SDL_rwlock_srw
SDL_threadID write_owner;
} SDL_rwlock_srw;
static SDL_rwlock *SDL_CreateRWLock_srw(void)
static SDL_RWLock *SDL_CreateRWLock_srw(void)
{
SDL_rwlock_srw *rwlock = (SDL_rwlock_srw *)SDL_calloc(1, sizeof(*rwlock));
if (rwlock == NULL) {
SDL_OutOfMemory();
}
pInitializeSRWLock(&rwlock->srw);
return (SDL_rwlock *)rwlock;
return (SDL_RWLock *)rwlock;
}
static void SDL_DestroyRWLock_srw(SDL_rwlock *_rwlock)
static void SDL_DestroyRWLock_srw(SDL_RWLock *_rwlock)
{
SDL_rwlock_srw *rwlock = (SDL_rwlock_srw *) _rwlock;
if (rwlock) {
@ -104,7 +104,7 @@ static void SDL_DestroyRWLock_srw(SDL_rwlock *_rwlock)
}
}
static int SDL_LockRWLockForReading_srw(SDL_rwlock *_rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
static int SDL_LockRWLockForReading_srw(SDL_RWLock *_rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
SDL_rwlock_srw *rwlock = (SDL_rwlock_srw *) _rwlock;
if (rwlock == NULL) {
@ -114,7 +114,7 @@ static int SDL_LockRWLockForReading_srw(SDL_rwlock *_rwlock) SDL_NO_THREAD_SAFET
return 0;
}
static int SDL_LockRWLockForWriting_srw(SDL_rwlock *_rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
static int SDL_LockRWLockForWriting_srw(SDL_RWLock *_rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
SDL_rwlock_srw *rwlock = (SDL_rwlock_srw *) _rwlock;
if (rwlock == NULL) {
@ -125,7 +125,7 @@ static int SDL_LockRWLockForWriting_srw(SDL_rwlock *_rwlock) SDL_NO_THREAD_SAFET
return 0;
}
static int SDL_TryLockRWLockForReading_srw(SDL_rwlock *_rwlock)
static int SDL_TryLockRWLockForReading_srw(SDL_RWLock *_rwlock)
{
SDL_rwlock_srw *rwlock = (SDL_rwlock_srw *) _rwlock;
int retval = 0;
@ -138,7 +138,7 @@ static int SDL_TryLockRWLockForReading_srw(SDL_rwlock *_rwlock)
return retval;
}
static int SDL_TryLockRWLockForWriting_srw(SDL_rwlock *_rwlock)
static int SDL_TryLockRWLockForWriting_srw(SDL_RWLock *_rwlock)
{
SDL_rwlock_srw *rwlock = (SDL_rwlock_srw *) _rwlock;
int retval = 0;
@ -151,7 +151,7 @@ static int SDL_TryLockRWLockForWriting_srw(SDL_rwlock *_rwlock)
return retval;
}
static int SDL_UnlockRWLock_srw(SDL_rwlock *_rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
static int SDL_UnlockRWLock_srw(SDL_RWLock *_rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
SDL_rwlock_srw *rwlock = (SDL_rwlock_srw *) _rwlock;
if (rwlock == NULL) {
@ -179,7 +179,7 @@ static const SDL_rwlock_impl_t SDL_rwlock_impl_srw = {
#include "../generic/SDL_sysrwlock_c.h"
/* Generic rwlock implementation using SDL_mutex, SDL_cond, and SDL_AtomicInt */
/* Generic rwlock implementation using SDL_Mutex, SDL_Condition, and SDL_AtomicInt */
static const SDL_rwlock_impl_t SDL_rwlock_impl_generic = {
&SDL_CreateRWLock_generic,
&SDL_DestroyRWLock_generic,
@ -191,7 +191,7 @@ static const SDL_rwlock_impl_t SDL_rwlock_impl_generic = {
};
#endif
SDL_rwlock *SDL_CreateRWLock(void)
SDL_RWLock *SDL_CreateRWLock(void)
{
if (SDL_rwlock_impl_active.Create == NULL) {
const SDL_rwlock_impl_t *impl;
@ -227,32 +227,32 @@ SDL_rwlock *SDL_CreateRWLock(void)
return SDL_rwlock_impl_active.Create();
}
void SDL_DestroyRWLock(SDL_rwlock *rwlock)
void SDL_DestroyRWLock(SDL_RWLock *rwlock)
{
SDL_rwlock_impl_active.Destroy(rwlock);
}
int SDL_LockRWLockForReading(SDL_rwlock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
int SDL_LockRWLockForReading(SDL_RWLock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
return SDL_rwlock_impl_active.LockForReading(rwlock);
}
int SDL_LockRWLockForWriting(SDL_rwlock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
int SDL_LockRWLockForWriting(SDL_RWLock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
return SDL_rwlock_impl_active.LockForWriting(rwlock);
}
int SDL_TryLockRWLockForReading(SDL_rwlock *rwlock)
int SDL_TryLockRWLockForReading(SDL_RWLock *rwlock)
{
return SDL_rwlock_impl_active.TryLockForReading(rwlock);
}
int SDL_TryLockRWLockForWriting(SDL_rwlock *rwlock)
int SDL_TryLockRWLockForWriting(SDL_RWLock *rwlock)
{
return SDL_rwlock_impl_active.TryLockForWriting(rwlock);
}
int SDL_UnlockRWLock(SDL_rwlock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
int SDL_UnlockRWLock(SDL_RWLock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
return SDL_rwlock_impl_active.Unlock(rwlock);
}

View File

@ -35,11 +35,11 @@
#include "../../core/windows/SDL_windows.h"
typedef SDL_sem *(*pfnSDL_CreateSemaphore)(Uint32);
typedef void (*pfnSDL_DestroySemaphore)(SDL_sem *);
typedef int (*pfnSDL_WaitSemaphoreTimeoutNS)(SDL_sem *, Sint64);
typedef Uint32 (*pfnSDL_GetSemaphoreValue)(SDL_sem *);
typedef int (*pfnSDL_PostSemaphore)(SDL_sem *);
typedef SDL_Semaphore *(*pfnSDL_CreateSemaphore)(Uint32);
typedef void (*pfnSDL_DestroySemaphore)(SDL_Semaphore *);
typedef int (*pfnSDL_WaitSemaphoreTimeoutNS)(SDL_Semaphore *, Sint64);
typedef Uint32 (*pfnSDL_GetSemaphoreValue)(SDL_Semaphore *);
typedef int (*pfnSDL_PostSemaphore)(SDL_Semaphore *);
typedef struct SDL_semaphore_impl_t
{
@ -78,7 +78,7 @@ typedef struct SDL_semaphore_atom
LONG count;
} SDL_sem_atom;
static SDL_sem *SDL_CreateSemaphore_atom(Uint32 initial_value)
static SDL_Semaphore *SDL_CreateSemaphore_atom(Uint32 initial_value)
{
SDL_sem_atom *sem;
@ -88,17 +88,17 @@ static SDL_sem *SDL_CreateSemaphore_atom(Uint32 initial_value)
} else {
SDL_OutOfMemory();
}
return (SDL_sem *)sem;
return (SDL_Semaphore *)sem;
}
static void SDL_DestroySemaphore_atom(SDL_sem *sem)
static void SDL_DestroySemaphore_atom(SDL_Semaphore *sem)
{
if (sem != NULL) {
SDL_free(sem);
}
}
static int SDL_WaitSemaphoreTimeoutNS_atom(SDL_sem *_sem, Sint64 timeoutNS)
static int SDL_WaitSemaphoreTimeoutNS_atom(SDL_Semaphore *_sem, Sint64 timeoutNS)
{
SDL_sem_atom *sem = (SDL_sem_atom *)_sem;
LONG count;
@ -172,7 +172,7 @@ static int SDL_WaitSemaphoreTimeoutNS_atom(SDL_sem *_sem, Sint64 timeoutNS)
}
}
static Uint32 SDL_GetSemaphoreValue_atom(SDL_sem *_sem)
static Uint32 SDL_GetSemaphoreValue_atom(SDL_Semaphore *_sem)
{
SDL_sem_atom *sem = (SDL_sem_atom *)_sem;
@ -184,7 +184,7 @@ static Uint32 SDL_GetSemaphoreValue_atom(SDL_sem *_sem)
return (Uint32)sem->count;
}
static int SDL_PostSemaphore_atom(SDL_sem *_sem)
static int SDL_PostSemaphore_atom(SDL_Semaphore *_sem)
{
SDL_sem_atom *sem = (SDL_sem_atom *)_sem;
@ -218,7 +218,7 @@ typedef struct SDL_semaphore_kern
} SDL_sem_kern;
/* Create a semaphore */
static SDL_sem *SDL_CreateSemaphore_kern(Uint32 initial_value)
static SDL_Semaphore *SDL_CreateSemaphore_kern(Uint32 initial_value)
{
SDL_sem_kern *sem;
@ -240,11 +240,11 @@ static SDL_sem *SDL_CreateSemaphore_kern(Uint32 initial_value)
} else {
SDL_OutOfMemory();
}
return (SDL_sem *)sem;
return (SDL_Semaphore *)sem;
}
/* Free the semaphore */
static void SDL_DestroySemaphore_kern(SDL_sem *_sem)
static void SDL_DestroySemaphore_kern(SDL_Semaphore *_sem)
{
SDL_sem_kern *sem = (SDL_sem_kern *)_sem;
if (sem != NULL) {
@ -256,7 +256,7 @@ static void SDL_DestroySemaphore_kern(SDL_sem *_sem)
}
}
static int SDL_WaitSemaphoreTimeoutNS_kern(SDL_sem *_sem, Sint64 timeoutNS)
static int SDL_WaitSemaphoreTimeoutNS_kern(SDL_Semaphore *_sem, Sint64 timeoutNS)
{
SDL_sem_kern *sem = (SDL_sem_kern *)_sem;
int retval;
@ -287,7 +287,7 @@ static int SDL_WaitSemaphoreTimeoutNS_kern(SDL_sem *_sem, Sint64 timeoutNS)
}
/* Returns the current count of the semaphore */
static Uint32 SDL_GetSemaphoreValue_kern(SDL_sem *_sem)
static Uint32 SDL_GetSemaphoreValue_kern(SDL_Semaphore *_sem)
{
SDL_sem_kern *sem = (SDL_sem_kern *)_sem;
if (sem == NULL) {
@ -297,7 +297,7 @@ static Uint32 SDL_GetSemaphoreValue_kern(SDL_sem *_sem)
return (Uint32)sem->count;
}
static int SDL_PostSemaphore_kern(SDL_sem *_sem)
static int SDL_PostSemaphore_kern(SDL_Semaphore *_sem)
{
SDL_sem_kern *sem = (SDL_sem_kern *)_sem;
if (sem == NULL) {
@ -328,7 +328,7 @@ static const SDL_sem_impl_t SDL_sem_impl_kern = {
* Runtime selection and redirection
*/
SDL_sem *
SDL_Semaphore *
SDL_CreateSemaphore(Uint32 initial_value)
{
if (SDL_sem_impl_active.Create == NULL) {
@ -367,23 +367,23 @@ SDL_CreateSemaphore(Uint32 initial_value)
return SDL_sem_impl_active.Create(initial_value);
}
void SDL_DestroySemaphore(SDL_sem *sem)
void SDL_DestroySemaphore(SDL_Semaphore *sem)
{
SDL_sem_impl_active.Destroy(sem);
}
int SDL_WaitSemaphoreTimeoutNS(SDL_sem *sem, Sint64 timeoutNS)
int SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
{
return SDL_sem_impl_active.WaitTimeoutNS(sem, timeoutNS);
}
Uint32
SDL_GetSemaphoreValue(SDL_sem *sem)
SDL_GetSemaphoreValue(SDL_Semaphore *sem)
{
return SDL_sem_impl_active.Value(sem);
}
int SDL_PostSemaphore(SDL_sem *sem)
int SDL_PostSemaphore(SDL_Semaphore *sem)
{
return SDL_sem_impl_active.Post(sem);
}

View File

@ -52,14 +52,14 @@ typedef struct
SDL_Thread *thread;
SDL_AtomicInt nextID;
SDL_TimerMap *timermap;
SDL_mutex *timermap_lock;
SDL_Mutex *timermap_lock;
/* Padding to separate cache lines between threads */
char cache_pad[SDL_CACHELINE_SIZE];
/* Data used to communicate with the timer thread */
SDL_SpinLock lock;
SDL_sem *sem;
SDL_Semaphore *sem;
SDL_Timer *pending;
SDL_Timer *freelist;
SDL_AtomicInt active;

View File

@ -354,7 +354,7 @@ struct SDL_VideoDevice
SDL_bool is_dummy;
SDL_bool suspend_screensaver;
SDL_Window *wakeup_window;
SDL_mutex *wakeup_lock; /* Initialized only if WaitEventTimeout/SendWakeupEvent are supported */
SDL_Mutex *wakeup_lock; /* Initialized only if WaitEventTimeout/SendWakeupEvent are supported */
int num_displays;
SDL_VideoDisplay *displays;
SDL_Window *windows;

View File

@ -62,9 +62,9 @@ static int Android_DeviceHeight = 0;
static Uint32 Android_ScreenFormat = SDL_PIXELFORMAT_RGB565; /* Default SurfaceView format, in case this is queried before being filled */
float Android_ScreenDensity = 1.0f;
static float Android_ScreenRate = 0.0f;
SDL_sem *Android_PauseSem = NULL;
SDL_sem *Android_ResumeSem = NULL;
SDL_mutex *Android_ActivityMutex = NULL;
SDL_Semaphore *Android_PauseSem = NULL;
SDL_Semaphore *Android_ResumeSem = NULL;
SDL_Mutex *Android_ActivityMutex = NULL;
static SDL_SystemTheme Android_SystemTheme;
static int Android_SuspendScreenSaver(_THIS)

View File

@ -44,7 +44,7 @@ struct SDL_VideoData
extern int Android_SurfaceWidth;
extern int Android_SurfaceHeight;
extern float Android_ScreenDensity;
extern SDL_sem *Android_PauseSem, *Android_ResumeSem;
extern SDL_mutex *Android_ActivityMutex;
extern SDL_Semaphore *Android_PauseSem, *Android_ResumeSem;
extern SDL_Mutex *Android_ActivityMutex;
#endif /* SDL_androidvideo_h_ */

View File

@ -45,9 +45,9 @@ struct SDL_GLDriverData
SDL_Window *window;
CVDisplayLinkRef displayLink;
@public
SDL_mutex *swapIntervalMutex;
SDL_Mutex *swapIntervalMutex;
@public
SDL_cond *swapIntervalCond;
SDL_Condition *swapIntervalCond;
@public
SDL_AtomicInt swapIntervalSetting;
@public

View File

@ -104,7 +104,7 @@ DECLARE_ALERT_STYLE(Critical);
@property(nonatomic) SDLTranslatorResponder *fieldEdit;
@property(nonatomic) NSInteger clipboard_count;
@property(nonatomic) IOPMAssertionID screensaver_assertion;
@property(nonatomic) SDL_mutex *swaplock;
@property(nonatomic) SDL_Mutex *swaplock;
@end
/* Utility functions */

View File

@ -45,7 +45,7 @@ static SDL_Keycode keymap[256];
#endif
static enum PspHprmKeys hprm = 0;
static SDL_sem *event_sem = NULL;
static SDL_Semaphore *event_sem = NULL;
static SDL_Thread *thread = NULL;
static int running = 0;
static struct

View File

@ -46,8 +46,8 @@ struct SDL_WindowData
#endif
/* Vsync callback cond and mutex */
SDL_cond *vsync_cond;
SDL_mutex *vsync_cond_mutex;
SDL_Condition *vsync_cond;
SDL_Mutex *vsync_cond_mutex;
SDL_bool double_buffer;
};

View File

@ -68,8 +68,8 @@ enum SDL_XAMLAppThreadState
static SDL_XAMLAppThreadState _threadState = ThreadState_NotLaunched;
static SDL_Thread *_XAMLThread = nullptr;
static SDL_mutex *_mutex = nullptr;
static SDL_cond *_cond = nullptr;
static SDL_Mutex *_mutex = nullptr;
static SDL_Condition *_cond = nullptr;
static void WINRT_YieldXAMLThread()
{

View File

@ -110,7 +110,7 @@ SDL_COMPILE_TIME_ASSERT(size, CountTo_GreaterThanZero); /* check for rollover */
static SDL_AtomicInt good = { 42 };
static atomicValue bad = 42;
static SDL_AtomicInt threadsRunning;
static SDL_sem *threadDone;
static SDL_Semaphore *threadDone;
static int SDLCALL adder(void *junk)
{
@ -285,7 +285,7 @@ typedef struct
SDL_AtomicInt active;
/* Only needed for the mutex test */
SDL_mutex *mutex;
SDL_Mutex *mutex;
} SDL_EventQueue;

View File

@ -21,7 +21,7 @@
#include <SDL3/SDL_main.h>
#include <SDL3/SDL_test.h>
static SDL_mutex *mutex = NULL;
static SDL_Mutex *mutex = NULL;
static SDL_threadID mainthread;
static SDL_AtomicInt doterminate;
static int nb_threads = 6;

View File

@ -18,7 +18,7 @@
#include <SDL3/SDL_main.h>
#include <SDL3/SDL_test.h>
static SDL_rwlock *rwlock = NULL;
static SDL_RWLock *rwlock = NULL;
static SDL_threadID mainthread;
static SDL_AtomicInt doterminate;
static int nb_threads = 6;

View File

@ -24,7 +24,7 @@
#define NUM_OVERHEAD_OPS 10000
#define NUM_OVERHEAD_OPS_MULT 10
static SDL_sem *sem;
static SDL_Semaphore *sem;
static int alive;
typedef struct Thread_State