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