]> git.saurik.com Git - apple/xnu.git/blame - bsd/man/man2/sem_post.2
xnu-2782.1.97.tar.gz
[apple/xnu.git] / bsd / man / man2 / sem_post.2
CommitLineData
6d2010ae
A
1.\" $Darwin$
2.\"
3.\" Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
4.\"
5.\" @APPLE_LICENSE_HEADER_START@
6.\"
7.\" The contents of this file constitute Original Code as defined in and
8.\" are subject to the Apple Public Source License Version 1.1 (the
9.\" "License"). You may not use this file except in compliance with the
10.\" License. Please obtain a copy of the License at
11.\" http://www.apple.com/publicsource and read it before using this file.
12.\"
13.\" This Original Code and all software distributed under the License are
14.\" distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15.\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16.\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17.\" FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
18.\" License for the specific language governing rights and limitations
19.\" under the License.
20.\"
21.\" @APPLE_LICENSE_HEADER_END@
22.\"
23.Dd June 8, 2000
24.Dt SEM_POST 2
25.Os Darwin
26.Sh NAME
27.Nm sem_post
28.Nd unlock a semaphore
29.Sh SYNOPSIS
30.Fd #include <semaphore.h>
31.Ft int
32.Fn sem_post "sem_t *sem"
33.Sh DESCRIPTION
34The semaphore referenced by
35.Fa sem
36is unlocked, the value of the semaphore is incremented, and all
37threads which are waiting on the semaphore are awakened.
38.Pp
39.Fn sem_post
40is reentrant with respect to signals and may be called from within a
41signal hanlder.
42.Pp
43If successful,
44.Fn sem_post
45will return 0. Otherwise, -1 is returned and
46.Va errno
47is set.
48.Sh ERRORS
49.Fn sem_post
50succeeds unless:
51.Bl -tag -width Er
52.It Bq Er EINVAL
53.Fa sem
54is not a valid semaphore descriptor.
55.El
56.Sh SEE ALSO
57.Xr sem_open 2 ,
58.Xr sem_trywait 2 ,
59.Xr sem_wait 2 ,
60.Xr semctl 2 ,
61.Xr semget 2 ,
62.Xr semop 2
63.Sh HISTORY
64.Fn sem_post
65is specified in the POSIX Realtime Extension (1003.1b-1993/1003.1i-1995).