Penguin

SDL_!SemWait?

SDL_!SemWait?

NAME SYNOPSIS DESCRIPTION RETURN VALUE EXAMPLES SEE ALSO


NAME

SDL_!SemWait?- Lock a semaphore and suspend the thread if the semaphore value is zero.

SYNOPSIS

#include

int SDL_!SemWait?(SDL_sem *sem);

DESCRIPTION

SDL_!SemWait?() suspends the calling thread until either the semaphore pointed to by sem has a positive value, the call is interrupted by a signal or error. If the call is successful it will atomically decrement the semaphore value.

After SDL_!SemWait?() is successful, the semaphore can be released and its count atomically incremented by a successful call to SDL_!SemPost?.

RETURN VALUE

Returns 0 if successful or -1 if there was an error (leaving the semaphore unchanged).

EXAMPLES

if (SDL_!SemWait?(my_sem) == -1) { return WAIT_FAILED; } ... SDL_!SemPost?(my_sem);

SEE ALSO

SDL_!CreateSemaphore?, SDL_!DestroySemaphore?, SDL_!SemTryWait?, SDL_!SemWaitTimeout?, SDL_!SemPost?, SDL_!SemValue?


This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.