Wait on a named or unnamed semaphore, but don't block
#include <semaphore.h> int sem_trywait( sem_t * sem );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The sem_trywait() function decrements the semaphore if the semaphore's value is greater than zero; otherwise, the function simply returns.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |