Returns the value of a semaphore.
#include <semaphore.h> int sem_getvalue ( sem_t *sem, int *value);
(IN) Points to the semaphore.
(OUT) Points to the value of the semaphore.
If successful, returns zero; otherwise, returns -1 and sets errno to one of the following values:
The sem_getvalue function returns a value that was current at some time during the call, but this value is not guaranteed to still be current when the call returns. If the semaphore is locked, the value returned is either 0 or a negative number representing the number of processes that were waiting for the semaphore at some time during the call.