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