Section: Linux Programmer's Manual (3)
Return to Main Contents
sem_getvalue - get the value of a semaphore
int sem_getvalue(sem_t *sem, int *sval);
Link with -pthread.
places the current value of the semaphore pointed to
into the integer pointed to by
If one or more processes or threads are blocked
waiting to lock the semaphore with
POSIX.1-2001 permits two possibilities for the value returned in
either 0 is returned;
or a negative number whose absolute value is the count
of the number of processes and threads currently blocked in
Linux adopts the former behavior.
returns 0 on success;
on error, -1 is returned and
is set to indicate the error.
is not a valid semaphore.
The value of the semaphore may already have changed by the time
This page is part of release 3.54 of the Linux
A description of the project,
and information about reporting bugs,
can be found at
- RETURN VALUE
- CONFORMING TO
- SEE ALSO
This document was created by
using the manual pages.
Time: 21:16:11 GMT, January 16, 2018