![]() |
![]() |
![]() |
Wait on a semaphore
#include <sys/neutrino.h> int SyncSemWait( sync_t* sync, int try ); int SyncSemWait_r( sync_t* sync, int try );
libc
The SyncSemWait() and SyncSemWait_r() functions are identical except in the way they indicate errors. See the Returns section for details.
These kernel calls decrement the semaphore referred to by the sync argument. If the semaphore value isn't greater than zero and try is zero, then the calling process blocks until it can decrement the counter or the call is interrupted by signal.
If try is nonzero then it acts as a conditional wait. If the call would block, the semaphore is unmodified and the call returns with an error.
The only difference between these functions is the way they indicate errors:
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
sem_destroy(), sem_init(), sem_post(), sem_trywait(), sem_wait(), SyncDestroy()
![]() |
![]() |
![]() |