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

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