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

This commit is contained in:
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;

Some files were not shown because too many files have changed in this diff Show More