1SDL_CreateSemaphore(3)         SDL API Reference        SDL_CreateSemaphore(3)
2
3
4

NAME

6       SDL_CreateSemaphore  -  Creates  a new semaphore and assigns an initial
7       value to it.
8

SYNOPSIS

10       #include "SDL.h" #include "SDL_thread.h"
11
12       SDL_sem *SDL_CreateSemaphore(Uint32 initial_value);
13

DESCRIPTION

15       SDL_CreateSemaphore() creates a new semaphore and initializes  it  with
16       the  value  initial_value.  Each  locking operation on the semaphore by
17       SDL_SemWait,  SDL_SemTryWait  or  SDL_SemWaitTimeout  will   atomically
18       decrement the semaphore value. The locking operation will be blocked if
19       the semaphore value is not positive (greater than  zero).  Each  unlock
20       operation by SDL_SemPost will atomically increment the semaphore value.
21

RETURN VALUE

23       Returns  a  pointer to an initialized semaphore or NULL if there was an
24       error.
25

EXAMPLES

27       SDL_sem *my_sem;
28
29       my_sem = SDL_CreateSemaphore(INITIAL_SEM_VALUE);
30
31       if (my_sem == NULL) {
32               return CREATE_SEM_FAILED;
33       }
34

SEE ALSO

36       SDL_DestroySemaphore, SDL_SemWait, SDL_SemTryWait,  SDL_SemWaitTimeout,
37       SDL_SemPost, SDL_SemValue
38
39
40
41SDL                         Tue 11 Sep 2001, 23:00      SDL_CreateSemaphore(3)
Impressum