1SEM_POST(3) Linux Programmer's Manual SEM_POST(3)
2
3
4
6 sem_post - unlock a semaphore
7
9 #include <semaphore.h>
10
11 int sem_post(sem_t *sem);
12
13 Link with -lrt or -pthread.
14
16 sem_post() increments (unlocks) the semaphore pointed to by sem. If
17 the semaphore's value consequently becomes greater than zero, then
18 another process or thread blocked in a sem_wait(3) call will be woken
19 up and proceed to lock the semaphore.
20
22 sem_post() returns 0 on success; on error, the value of the semaphore
23 is left unchanged, -1 is returned, and errno is set to indicate the
24 error.
25
27 EINVAL sem is not a valid semaphore.
28
29 EOVERFLOW
30 The maximum allowable value for a semaphore would be exceeded.
31
33 POSIX.1-2001.
34
36 sem_post() is async-signal-safe: it may be safely called within a sig‐
37 nal handler.
38
40 See sem_wait(3).
41
43 sem_getvalue(3), sem_wait(3), sem_overview(7)
44
46 This page is part of release 3.25 of the Linux man-pages project. A
47 description of the project, and information about reporting bugs, can
48 be found at http://www.kernel.org/doc/man-pages/.
49
50
51
52Linux 2009-03-30 SEM_POST(3)