26 #include "SDL_thread.h"
30 #if SDL_THREADS_DISABLED
47 return SDL_SetError(
"SDL not built with thread support");
53 return SDL_SetError(
"SDL not built with thread support");
59 return SDL_SetError(
"SDL not built with thread support");
71 return SDL_SetError(
"SDL not built with thread support");
94 sem->count = initial_value;
95 sem->waiters_count = 0;
99 if (!sem->count_lock || !sem->count_nonzero) {
114 sem->count = 0xFFFFFFFF;
115 while (sem->waiters_count > 0) {
120 if (sem->count_lock) {
140 if (sem->count > 0) {
164 ++sem->waiters_count;
168 sem->count_lock, timeout);
170 --sem->waiters_count;
207 if (sem->waiters_count > 0) {
DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value)
DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond *cond)
#define SDL_MUTEX_MAXWAIT
DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms)
DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem *sem)
struct SDL_semaphore SDL_sem
DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem *sem, Uint32 ms)
DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex *mutex)
DECLSPEC int SDLCALL SDL_SemWait(SDL_sem *sem)
DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void)
DECLSPEC void SDLCALL SDL_free(void *mem)
DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex *mutex)
uint32_t Uint32
An unsigned 32-bit integer type.
DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond *cond)
DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem *sem)
DECLSPEC void SDLCALL SDL_Delay(Uint32 ms)
Wait a specified number of milliseconds before returning.
DECLSPEC int SDLCALL SDL_SetError(const char *fmt,...)
DECLSPEC void *SDLCALL SDL_malloc(size_t size)
GLbitfield GLuint64 timeout
DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void)
DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem)
#define SDL_OutOfMemory()
struct SDL_mutex SDL_mutex
EGLSurface EGLint void ** value
DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex *mutex)
#define SDL_MUTEX_TIMEDOUT
DECLSPEC int SDLCALL SDL_SemPost(SDL_sem *sem)