1SEM_GETVALUE(3)            Linux Programmer's Manual           SEM_GETVALUE(3)
2
3
4

NAME

6       sem_getvalue - get the value of a semaphore
7

SYNOPSIS

9       #include <semaphore.h>
10
11       int sem_getvalue(sem_t *sem, int *sval);
12
13       Link with -lrt or -pthread.
14

DESCRIPTION

16       sem_getvalue() places the current value of the semaphore pointed to sem
17       into the integer pointed to by sval.
18
19       If one or more processes or threads are blocked  waiting  to  lock  the
20       semaphore  with sem_wait(3), POSIX.1-2001 permits two possibilities for
21       the value returned in sval: either 0 is returned; or a negative  number
22       whose  absolute  value  is  the  count  of  the number of processes and
23       threads currently blocked in  sem_wait(3).   Linux  adopts  the  former
24       behavior.
25

RETURN VALUE

27       sem_getvalue() returns 0 on success; on error, -1 is returned and errno
28       is set to indicate the error.
29

ERRORS

31       EINVAL sem is not a valid semaphore.
32

CONFORMING TO

34       POSIX.1-2001.
35

NOTES

37       The value of the  semaphore  may  already  have  changed  by  the  time
38       sem_getvalue() returns.
39

SEE ALSO

41       sem_post(3), sem_wait(3), sem_overview(7)
42

COLOPHON

44       This  page  is  part of release 3.22 of the Linux man-pages project.  A
45       description of the project, and information about reporting  bugs,  can
46       be found at http://www.kernel.org/doc/man-pages/.
47
48
49
50Linux                             2006-03-25                   SEM_GETVALUE(3)
Impressum