SDL
2.0
|
#include "../../SDL_internal.h"
#include <errno.h>
#include <pthread.h>
#include <semaphore.h>
#include <sys/time.h>
#include <time.h>
#include "SDL_thread.h"
#include "SDL_timer.h"
Go to the source code of this file.
Data Structures | |
struct | SDL_sem |
Functions | |
SDL_sem * | SDL_CreateSemaphore (Uint32 initial_value) |
void | SDL_DestroySemaphore (SDL_sem *sem) |
int | SDL_SemTryWait (SDL_sem *sem) |
int | SDL_SemWait (SDL_sem *sem) |
int | SDL_SemWaitTimeout (SDL_sem *sem, Uint32 timeout) |
Uint32 | SDL_SemValue (SDL_sem *sem) |
int | SDL_SemPost (SDL_sem *sem) |
SDL_sem* SDL_CreateSemaphore | ( | Uint32 | initial_value | ) |
Create a semaphore, initialized with value, returns NULL on failure.
Definition at line 46 of file SDL_syssem.c.
References NULL, SDL_free, SDL_malloc, SDL_OutOfMemory, SDL_SetError, and SDL_sem::sem.
void SDL_DestroySemaphore | ( | SDL_sem * | sem | ) |
int SDL_SemPost | ( | SDL_sem * | sem | ) |
Atomically increases the semaphore's count (not blocking).
Definition at line 193 of file SDL_syssem.c.
References retval, and SDL_SetError.
int SDL_SemTryWait | ( | SDL_sem * | sem | ) |
Non-blocking variant of SDL_SemWait().
Definition at line 71 of file SDL_syssem.c.
References retval, SDL_MUTEX_TIMEDOUT, and SDL_SetError.
Uint32 SDL_SemValue | ( | SDL_sem * | sem | ) |
int SDL_SemWait | ( | SDL_sem * | sem | ) |
This function suspends the calling thread until the semaphore pointed to by sem
has a positive count. It then atomically decreases the semaphore count.
Definition at line 86 of file SDL_syssem.c.
References retval, and SDL_SetError.
int SDL_SemWaitTimeout | ( | SDL_sem * | sem, |
Uint32 | ms | ||
) |
Variant of SDL_SemWait() with a timeout in milliseconds.
Definition at line 105 of file SDL_syssem.c.
References NULL, retval, SDL_Delay, SDL_GetTicks(), SDL_MUTEX_MAXWAIT, SDL_MUTEX_TIMEDOUT, SDL_SemTryWait(), SDL_SemWait(), SDL_SetError, and SDL_TICKS_PASSED.