29 #include "SDL_thread.h"
51 cond->waiting = cond->signals = 0;
52 if (!cond->lock || !cond->wait_sem || !cond->wait_done) {
70 if (cond->wait_done) {
92 if (cond->waiting > cond->signals) {
109 return SDL_SetError(
"Passed a NULL condition variable");
116 if (cond->waiting > cond->signals) {
119 num_waiting = (cond->waiting - cond->signals);
120 cond->signals = cond->waiting;
121 for (i = 0; i < num_waiting; ++
i) {
128 for (i = 0; i < num_waiting; ++
i) {
165 return SDL_SetError(
"Passed a NULL condition variable");
193 if (cond->signals > 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)
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_CondBroadcast(SDL_cond *cond)
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 int SDLCALL SDL_SetError(const char *fmt,...)
DECLSPEC void *SDLCALL SDL_malloc(size_t size)
DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void)
DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem)
#define SDL_OutOfMemory()
struct SDL_mutex SDL_mutex
DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex *mutex)
DECLSPEC int SDLCALL SDL_SemPost(SDL_sem *sem)
DECLSPEC int SDLCALL SDL_CondWait(SDL_cond *cond, SDL_mutex *mutex)