zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_syssem.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include "SDL_error.h"
#include "SDL_thread.h"
#include <pspthreadman.h>
#include <pspkerror.h>

Go to the source code of this file.

Functions

SDL_semSDL_CreateSemaphore (Uint32 initial_value)
 
void SDL_DestroySemaphore (SDL_sem *sem)
 
int SDL_SemPost (SDL_sem *sem)
 
int SDL_SemTryWait (SDL_sem *sem)
 
Uint32 SDL_SemValue (SDL_sem *sem)
 
int SDL_SemWait (SDL_sem *sem)
 
int SDL_SemWaitTimeout (SDL_sem *sem, Uint32 timeout)
 

Function Documentation

SDL_sem* SDL_CreateSemaphore ( Uint32  initial_value)

Create a semaphore, initialized with value, returns NULL on failure.

Definition at line 39 of file SDL_syssem.c.

References free, malloc, NULL, SDL_OutOfMemory, and SDL_SetError().

void SDL_DestroySemaphore ( SDL_sem sem)

Destroy a semaphore.

Definition at line 60 of file SDL_syssem.c.

References free, and NULL.

int SDL_SemPost ( SDL_sem sem)

Atomically increases the semaphore's count (not blocking).

Returns
0, or -1 on error.

Definition at line 139 of file SDL_syssem.c.

References NULL, and SDL_SetError().

int SDL_SemTryWait ( SDL_sem sem)

Non-blocking variant of SDL_SemWait().

Returns
0 if the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait would block, and -1 on error.

Definition at line 112 of file SDL_syssem.c.

References SDL_SemWaitTimeout().

Uint32 SDL_SemValue ( SDL_sem sem)

Returns the current count of the semaphore.

Definition at line 123 of file SDL_syssem.c.

References NULL, and SDL_SetError().

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 117 of file SDL_syssem.c.

References SDL_MUTEX_MAXWAIT, and SDL_SemWaitTimeout().

int SDL_SemWaitTimeout ( SDL_sem sem,
Uint32  ms 
)

Variant of SDL_SemWait() with a timeout in milliseconds.

Returns
0 if the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not succeed in the allotted time, and -1 on error.
Warning
On some platforms this function is implemented by looping with a delay of 1 ms, and so should be avoided if possible.

Definition at line 76 of file SDL_syssem.c.

References NULL, SDL_MUTEX_MAXWAIT, SDL_MUTEX_TIMEDOUT, and SDL_SetError().