tzfile.5, tzselect.8: sync from tzdb upstream
[man-pages.git] / man3 / sem_post.3
blob26fca7bffefbc11925fb547fe6c3f1d016116aca
1 '\" t
2 .\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .TH sem_post 3 (date) "Linux man-pages (unreleased)"
7 .SH NAME
8 sem_post \- unlock a semaphore
9 .SH LIBRARY
10 POSIX threads library
11 .RI ( libpthread ", " \-lpthread )
12 .SH SYNOPSIS
13 .nf
14 .B #include <semaphore.h>
15 .PP
16 .BI "int sem_post(sem_t *" sem );
17 .fi
18 .SH DESCRIPTION
19 .BR sem_post ()
20 increments (unlocks) the semaphore pointed to by
21 .IR sem .
22 If the semaphore's value consequently becomes greater than zero,
23 then another process or thread blocked in a
24 .BR sem_wait (3)
25 call will be woken up and proceed to lock the semaphore.
26 .SH RETURN VALUE
27 .BR sem_post ()
28 returns 0 on success;
29 on error, the value of the semaphore is left unchanged,
30 \-1 is returned, and
31 .I errno
32 is set to indicate the error.
33 .SH ERRORS
34 .TP
35 .B EINVAL
36 .I sem
37 is not a valid semaphore.
38 .TP
39 .B EOVERFLOW
40 .\" Added in POSIX.1-2008 TC1 (Austin Interpretation 213)
41 The maximum allowable value for a semaphore would be exceeded.
42 .SH ATTRIBUTES
43 For an explanation of the terms used in this section, see
44 .BR attributes (7).
45 .ad l
46 .nh
47 .TS
48 allbox;
49 lbx lb lb
50 l l l.
51 Interface       Attribute       Value
53 .BR sem_post ()
54 T}      Thread safety   MT-Safe
55 .TE
56 .hy
57 .ad
58 .sp 1
59 .SH STANDARDS
60 POSIX.1-2001.
61 .SH NOTES
62 .BR sem_post ()
63 is async-signal-safe:
64 it may be safely called within a signal handler.
65 .SH EXAMPLES
66 See
67 .BR sem_wait (3)
68 and
69 .BR shm_open (3).
70 .SH SEE ALSO
71 .BR sem_getvalue (3),
72 .BR sem_wait (3),
73 .BR sem_overview (7),
74 .BR signal\-safety (7)