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