Rename SDL semaphore and condition variable functions to match SDL 3.0 naming convention
Fixes https://github.com/libsdl-org/SDL/issues/7642
This commit is contained in:
@@ -23,19 +23,19 @@
|
||||
#include "../generic/SDL_syscond_c.h"
|
||||
#include "SDL_sysmutex_c.h"
|
||||
|
||||
typedef SDL_cond *(*pfnSDL_CreateCond)(void);
|
||||
typedef void (*pfnSDL_DestroyCond)(SDL_cond *);
|
||||
typedef int (*pfnSDL_CondSignal)(SDL_cond *);
|
||||
typedef int (*pfnSDL_CondBroadcast)(SDL_cond *);
|
||||
typedef int (*pfnSDL_CondWaitTimeoutNS)(SDL_cond *, SDL_mutex *, Sint64);
|
||||
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 struct SDL_cond_impl_t
|
||||
{
|
||||
pfnSDL_CreateCond Create;
|
||||
pfnSDL_DestroyCond Destroy;
|
||||
pfnSDL_CondSignal Signal;
|
||||
pfnSDL_CondBroadcast Broadcast;
|
||||
pfnSDL_CondWaitTimeoutNS WaitTimeoutNS;
|
||||
pfnSDL_CreateCondition Create;
|
||||
pfnSDL_DestroyCondition Destroy;
|
||||
pfnSDL_SignalCondition Signal;
|
||||
pfnSDL_BroadcastCondition Broadcast;
|
||||
pfnSDL_WaitConditionTimeoutNS WaitTimeoutNS;
|
||||
} SDL_cond_impl_t;
|
||||
|
||||
/* Implementation will be chosen at runtime based on available Kernel features */
|
||||
@@ -78,7 +78,7 @@ typedef struct SDL_cond_cv
|
||||
CONDITION_VARIABLE cond;
|
||||
} SDL_cond_cv;
|
||||
|
||||
static SDL_cond *SDL_CreateCond_cv(void)
|
||||
static SDL_cond *SDL_CreateCondition_cv(void)
|
||||
{
|
||||
SDL_cond_cv *cond;
|
||||
|
||||
@@ -91,7 +91,7 @@ static SDL_cond *SDL_CreateCond_cv(void)
|
||||
return (SDL_cond *)cond;
|
||||
}
|
||||
|
||||
static void SDL_DestroyCond_cv(SDL_cond *cond)
|
||||
static void SDL_DestroyCondition_cv(SDL_cond *cond)
|
||||
{
|
||||
if (cond != NULL) {
|
||||
/* There are no kernel allocated resources */
|
||||
@@ -99,7 +99,7 @@ static void SDL_DestroyCond_cv(SDL_cond *cond)
|
||||
}
|
||||
}
|
||||
|
||||
static int SDL_CondSignal_cv(SDL_cond *_cond)
|
||||
static int SDL_SignalCondition_cv(SDL_cond *_cond)
|
||||
{
|
||||
SDL_cond_cv *cond = (SDL_cond_cv *)_cond;
|
||||
if (cond == NULL) {
|
||||
@@ -111,7 +111,7 @@ static int SDL_CondSignal_cv(SDL_cond *_cond)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int SDL_CondBroadcast_cv(SDL_cond *_cond)
|
||||
static int SDL_BroadcastCondition_cv(SDL_cond *_cond)
|
||||
{
|
||||
SDL_cond_cv *cond = (SDL_cond_cv *)_cond;
|
||||
if (cond == NULL) {
|
||||
@@ -123,7 +123,7 @@ static int SDL_CondBroadcast_cv(SDL_cond *_cond)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int SDL_CondWaitTimeoutNS_cv(SDL_cond *_cond, SDL_mutex *_mutex, Sint64 timeoutNS)
|
||||
static int SDL_WaitConditionTimeoutNS_cv(SDL_cond *_cond, SDL_mutex *_mutex, Sint64 timeoutNS)
|
||||
{
|
||||
SDL_cond_cv *cond = (SDL_cond_cv *)_cond;
|
||||
DWORD timeout;
|
||||
@@ -187,27 +187,27 @@ static int SDL_CondWaitTimeoutNS_cv(SDL_cond *_cond, SDL_mutex *_mutex, Sint64 t
|
||||
}
|
||||
|
||||
static const SDL_cond_impl_t SDL_cond_impl_cv = {
|
||||
&SDL_CreateCond_cv,
|
||||
&SDL_DestroyCond_cv,
|
||||
&SDL_CondSignal_cv,
|
||||
&SDL_CondBroadcast_cv,
|
||||
&SDL_CondWaitTimeoutNS_cv,
|
||||
&SDL_CreateCondition_cv,
|
||||
&SDL_DestroyCondition_cv,
|
||||
&SDL_SignalCondition_cv,
|
||||
&SDL_BroadcastCondition_cv,
|
||||
&SDL_WaitConditionTimeoutNS_cv,
|
||||
};
|
||||
|
||||
|
||||
#ifndef __WINRT__
|
||||
/* Generic Condition Variable implementation using SDL_mutex and SDL_sem */
|
||||
static const SDL_cond_impl_t SDL_cond_impl_generic = {
|
||||
&SDL_CreateCond_generic,
|
||||
&SDL_DestroyCond_generic,
|
||||
&SDL_CondSignal_generic,
|
||||
&SDL_CondBroadcast_generic,
|
||||
&SDL_CondWaitTimeoutNS_generic,
|
||||
&SDL_CreateCondition_generic,
|
||||
&SDL_DestroyCondition_generic,
|
||||
&SDL_SignalCondition_generic,
|
||||
&SDL_BroadcastCondition_generic,
|
||||
&SDL_WaitConditionTimeoutNS_generic,
|
||||
};
|
||||
#endif
|
||||
|
||||
SDL_cond *
|
||||
SDL_CreateCond(void)
|
||||
SDL_CreateCondition(void)
|
||||
{
|
||||
if (SDL_cond_impl_active.Create == NULL) {
|
||||
const SDL_cond_impl_t *impl = NULL;
|
||||
@@ -249,22 +249,22 @@ SDL_CreateCond(void)
|
||||
return SDL_cond_impl_active.Create();
|
||||
}
|
||||
|
||||
void SDL_DestroyCond(SDL_cond *cond)
|
||||
void SDL_DestroyCondition(SDL_cond *cond)
|
||||
{
|
||||
SDL_cond_impl_active.Destroy(cond);
|
||||
}
|
||||
|
||||
int SDL_CondSignal(SDL_cond *cond)
|
||||
int SDL_SignalCondition(SDL_cond *cond)
|
||||
{
|
||||
return SDL_cond_impl_active.Signal(cond);
|
||||
}
|
||||
|
||||
int SDL_CondBroadcast(SDL_cond *cond)
|
||||
int SDL_BroadcastCondition(SDL_cond *cond)
|
||||
{
|
||||
return SDL_cond_impl_active.Broadcast(cond);
|
||||
}
|
||||
|
||||
int SDL_CondWaitTimeoutNS(SDL_cond *cond, SDL_mutex *mutex, Sint64 timeoutNS)
|
||||
int SDL_WaitConditionTimeoutNS(SDL_cond *cond, SDL_mutex *mutex, Sint64 timeoutNS)
|
||||
{
|
||||
return SDL_cond_impl_active.WaitTimeoutNS(cond, mutex, timeoutNS);
|
||||
}
|
||||
|
||||
@@ -37,17 +37,17 @@
|
||||
|
||||
typedef SDL_sem *(*pfnSDL_CreateSemaphore)(Uint32);
|
||||
typedef void (*pfnSDL_DestroySemaphore)(SDL_sem *);
|
||||
typedef int (*pfnSDL_SemWaitTimeoutNS)(SDL_sem *, Sint64);
|
||||
typedef Uint32 (*pfnSDL_SemValue)(SDL_sem *);
|
||||
typedef int (*pfnSDL_SemPost)(SDL_sem *);
|
||||
typedef int (*pfnSDL_WaitSemaphoreTimeoutNS)(SDL_sem *, Sint64);
|
||||
typedef Uint32 (*pfnSDL_GetSemaphoreValue)(SDL_sem *);
|
||||
typedef int (*pfnSDL_PostSemaphore)(SDL_sem *);
|
||||
|
||||
typedef struct SDL_semaphore_impl_t
|
||||
{
|
||||
pfnSDL_CreateSemaphore Create;
|
||||
pfnSDL_DestroySemaphore Destroy;
|
||||
pfnSDL_SemWaitTimeoutNS WaitTimeoutNS;
|
||||
pfnSDL_SemValue Value;
|
||||
pfnSDL_SemPost Post;
|
||||
pfnSDL_WaitSemaphoreTimeoutNS WaitTimeoutNS;
|
||||
pfnSDL_GetSemaphoreValue Value;
|
||||
pfnSDL_PostSemaphore Post;
|
||||
} SDL_sem_impl_t;
|
||||
|
||||
/* Implementation will be chosen at runtime based on available Kernel features */
|
||||
@@ -98,7 +98,7 @@ static void SDL_DestroySemaphore_atom(SDL_sem *sem)
|
||||
}
|
||||
}
|
||||
|
||||
static int SDL_SemWaitTimeoutNS_atom(SDL_sem *_sem, Sint64 timeoutNS)
|
||||
static int SDL_WaitSemaphoreTimeoutNS_atom(SDL_sem *_sem, Sint64 timeoutNS)
|
||||
{
|
||||
SDL_sem_atom *sem = (SDL_sem_atom *)_sem;
|
||||
LONG count;
|
||||
@@ -172,7 +172,7 @@ static int SDL_SemWaitTimeoutNS_atom(SDL_sem *_sem, Sint64 timeoutNS)
|
||||
}
|
||||
}
|
||||
|
||||
static Uint32 SDL_SemValue_atom(SDL_sem *_sem)
|
||||
static Uint32 SDL_GetSemaphoreValue_atom(SDL_sem *_sem)
|
||||
{
|
||||
SDL_sem_atom *sem = (SDL_sem_atom *)_sem;
|
||||
|
||||
@@ -184,7 +184,7 @@ static Uint32 SDL_SemValue_atom(SDL_sem *_sem)
|
||||
return (Uint32)sem->count;
|
||||
}
|
||||
|
||||
static int SDL_SemPost_atom(SDL_sem *_sem)
|
||||
static int SDL_PostSemaphore_atom(SDL_sem *_sem)
|
||||
{
|
||||
SDL_sem_atom *sem = (SDL_sem_atom *)_sem;
|
||||
|
||||
@@ -201,9 +201,9 @@ static int SDL_SemPost_atom(SDL_sem *_sem)
|
||||
static const SDL_sem_impl_t SDL_sem_impl_atom = {
|
||||
&SDL_CreateSemaphore_atom,
|
||||
&SDL_DestroySemaphore_atom,
|
||||
&SDL_SemWaitTimeoutNS_atom,
|
||||
&SDL_SemValue_atom,
|
||||
&SDL_SemPost_atom,
|
||||
&SDL_WaitSemaphoreTimeoutNS_atom,
|
||||
&SDL_GetSemaphoreValue_atom,
|
||||
&SDL_PostSemaphore_atom,
|
||||
};
|
||||
#endif /* !SDL_WINAPI_FAMILY_PHONE */
|
||||
|
||||
@@ -256,7 +256,7 @@ static void SDL_DestroySemaphore_kern(SDL_sem *_sem)
|
||||
}
|
||||
}
|
||||
|
||||
static int SDL_SemWaitTimeoutNS_kern(SDL_sem *_sem, Sint64 timeoutNS)
|
||||
static int SDL_WaitSemaphoreTimeoutNS_kern(SDL_sem *_sem, Sint64 timeoutNS)
|
||||
{
|
||||
SDL_sem_kern *sem = (SDL_sem_kern *)_sem;
|
||||
int retval;
|
||||
@@ -287,7 +287,7 @@ static int SDL_SemWaitTimeoutNS_kern(SDL_sem *_sem, Sint64 timeoutNS)
|
||||
}
|
||||
|
||||
/* Returns the current count of the semaphore */
|
||||
static Uint32 SDL_SemValue_kern(SDL_sem *_sem)
|
||||
static Uint32 SDL_GetSemaphoreValue_kern(SDL_sem *_sem)
|
||||
{
|
||||
SDL_sem_kern *sem = (SDL_sem_kern *)_sem;
|
||||
if (sem == NULL) {
|
||||
@@ -297,7 +297,7 @@ static Uint32 SDL_SemValue_kern(SDL_sem *_sem)
|
||||
return (Uint32)sem->count;
|
||||
}
|
||||
|
||||
static int SDL_SemPost_kern(SDL_sem *_sem)
|
||||
static int SDL_PostSemaphore_kern(SDL_sem *_sem)
|
||||
{
|
||||
SDL_sem_kern *sem = (SDL_sem_kern *)_sem;
|
||||
if (sem == NULL) {
|
||||
@@ -319,9 +319,9 @@ static int SDL_SemPost_kern(SDL_sem *_sem)
|
||||
static const SDL_sem_impl_t SDL_sem_impl_kern = {
|
||||
&SDL_CreateSemaphore_kern,
|
||||
&SDL_DestroySemaphore_kern,
|
||||
&SDL_SemWaitTimeoutNS_kern,
|
||||
&SDL_SemValue_kern,
|
||||
&SDL_SemPost_kern,
|
||||
&SDL_WaitSemaphoreTimeoutNS_kern,
|
||||
&SDL_GetSemaphoreValue_kern,
|
||||
&SDL_PostSemaphore_kern,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -372,18 +372,18 @@ void SDL_DestroySemaphore(SDL_sem *sem)
|
||||
SDL_sem_impl_active.Destroy(sem);
|
||||
}
|
||||
|
||||
int SDL_SemWaitTimeoutNS(SDL_sem *sem, Sint64 timeoutNS)
|
||||
int SDL_WaitSemaphoreTimeoutNS(SDL_sem *sem, Sint64 timeoutNS)
|
||||
{
|
||||
return SDL_sem_impl_active.WaitTimeoutNS(sem, timeoutNS);
|
||||
}
|
||||
|
||||
Uint32
|
||||
SDL_SemValue(SDL_sem *sem)
|
||||
SDL_GetSemaphoreValue(SDL_sem *sem)
|
||||
{
|
||||
return SDL_sem_impl_active.Value(sem);
|
||||
}
|
||||
|
||||
int SDL_SemPost(SDL_sem *sem)
|
||||
int SDL_PostSemaphore(SDL_sem *sem)
|
||||
{
|
||||
return SDL_sem_impl_active.Post(sem);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user