Wait on a named or unnamed semaphore
#include <semaphore.h> int sem_wait( sem_t * sem );
- A pointer to the sem_t object for the semaphore that you want to wait on.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The sem_wait() function decrements the semaphore referred to by the sem argument. If the semaphore value is not greater than zero, then the calling process blocks until it can decrement the counter, or the call is interrupted by signal.
Some process should eventually call sem_post() to increment the semaphore.
- The semaphore was successfully decremented.
- The state of the semaphore is unchanged ( errno is set).
- A deadlock condition was detected.
- Invalid semaphore descriptor sem.
- A signal interrupted this function.
Last modified: 2013-12-23