|
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"
Include dependency graph for SDL_syssem.c:Go to the source code of this file.
Data Structures | |
| struct | SDL_sem |
Macros | |
| #define | _GNU_SOURCE |
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) |
| #define _GNU_SOURCE |
Definition at line 24 of file SDL_syssem.c.
| SDL_sem* SDL_CreateSemaphore | ( | Uint32 | initial_value | ) |
Create a semaphore, initialized with value, returns NULL on failure.
Definition at line 49 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 74 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 89 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.