Get the value of a named or unnamed semaphore
#include <semaphore.h> int sem_getvalue( sem_t * sem, int * value );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The sem_getvalue() function takes a snapshot of the value of the semaphore, sem, and stores it in value. This value can change at any time, and is guaranteed valid only at some point in the sem_getvalue() call.
This function is provided for debugging semaphore code.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
sem_destroy(), sem_init(), sem_trywait(), sem_wait()