mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-02 07:58:30 +00:00
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:
@@ -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