]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/sem_post.3
Wrapped long lines, wrapped at sentence boundaries; stripped trailing
[thirdparty/man-pages.git] / man3 / sem_post.3
1 '\" t
2 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\"
4 .\" Copyright (C) 2006 Michael Kerrisk <mtk-manpages@gmx.net>
5 .\"
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date. The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .TH SEM_POST 3 2006-03-25 "Linux 2.6.16" "Linux Programmer's Manual"
24 .SH NAME
25 sem_post \- unlock a semaphore
26 .SH SYNOPSIS
27 .nf
28 .B #include <semaphore.h>
29 .sp
30 .BI "int sem_post(sem_t *" sem );
31 .fi
32 .SH DESCRIPTION
33 .BR sem_post ()
34 increments (unlocks) the semaphore pointed to by
35 .IR sem .
36 If the semaphore's value consequently becomes greater than zero,
37 then another process or thread blocked in a
38 .BR sem_wait (3)
39 call will be woken up and proceed to lock the semaphore.
40 .SH RETURN VALUE
41 .BR sem_post ()
42 returns 0 on success;
43 on error, the value of the semaphore is left unchanged,
44 \-1 is returned, and
45 .I errno
46 is set to indicate the error.
47 .SH ERRORS
48 .TP
49 .B EINVAL
50 .I sem
51 is not a valid semaphore.
52 .SH CONFORMING TO
53 POSIX.1-2001.
54 .SH NOTES
55 .BR sem_post ()
56 is async-signal-safe:
57 it may be safely called within a signal handler.
58 .SH "SEE ALSO"
59 .BR sem_getvalue (3),
60 .BR sem_wait (3),
61 .BR sem_overview (7)