Deleted Added
full compact
sema.9 (130482) sema.9 (131754)
1.\"
2.\" Copyright (C) 2001 Jason Evans <jasone@FreeBSD.org>. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice(s), this list of conditions and the following disclaimer as

--- 10 unchanged lines hidden (view full) ---

19.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
25.\" DAMAGE.
26.\"
1.\"
2.\" Copyright (C) 2001 Jason Evans <jasone@FreeBSD.org>. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice(s), this list of conditions and the following disclaimer as

--- 10 unchanged lines hidden (view full) ---

19.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
25.\" DAMAGE.
26.\"
27.\" $FreeBSD: head/share/man/man9/sema.9 130482 2004-06-14 18:33:21Z jdp $
27.\" $FreeBSD: head/share/man/man9/sema.9 131754 2004-07-07 19:57:16Z ru $
28.\"
29.Dd June 14, 2004
30.Dt SEMA 9
31.Os
32.Sh NAME
33.Nm sema ,
34.Nm sema_init ,
35.Nm sema_destroy ,

--- 59 unchanged lines hidden (view full) ---

95The
96.Fa timo
97argument to
98.Fn sema_timedwait
99specifies the minimum time in ticks to wait before returning with failure.
100.Fn sema_value
101is used to read the current value of the semaphore.
102.Sh RETURN VALUES
28.\"
29.Dd June 14, 2004
30.Dt SEMA 9
31.Os
32.Sh NAME
33.Nm sema ,
34.Nm sema_init ,
35.Nm sema_destroy ,

--- 59 unchanged lines hidden (view full) ---

95The
96.Fa timo
97argument to
98.Fn sema_timedwait
99specifies the minimum time in ticks to wait before returning with failure.
100.Fn sema_value
101is used to read the current value of the semaphore.
102.Sh RETURN VALUES
103The
103.Fn sema_value
104.Fn sema_value
105function
104returns the current value of the semaphore.
105.Pp
106If decrementing the semaphore would result in its value being negative,
107.Fn sema_trywait
108returns 0 to indicate failure.
109Otherwise, a non-zero value is returned to indicate success.
110.Pp
106returns the current value of the semaphore.
107.Pp
108If decrementing the semaphore would result in its value being negative,
109.Fn sema_trywait
110returns 0 to indicate failure.
111Otherwise, a non-zero value is returned to indicate success.
112.Pp
113The
111.Fn sema_timedwait
114.Fn sema_timedwait
115function
112returns 0 if waiting on the semaphore succeeded; otherwise a
113non-zero error code is returned.
114.Sh ERRORS
116returns 0 if waiting on the semaphore succeeded; otherwise a
117non-zero error code is returned.
118.Sh ERRORS
119The
115.Fn sema_timedwait
120.Fn sema_timedwait
116will fail if:
121function will fail if:
117.Bl -tag -width Er
118.It Bq Er EWOULDBLOCK
119Timeout expired.
120.El
121.Sh SEE ALSO
122.Xr condvar 9 ,
123.Xr mtx_pool 9 ,
124.Xr mutex 9 ,
125.Xr sx 9
122.Bl -tag -width Er
123.It Bq Er EWOULDBLOCK
124Timeout expired.
125.El
126.Sh SEE ALSO
127.Xr condvar 9 ,
128.Xr mtx_pool 9 ,
129.Xr mutex 9 ,
130.Xr sx 9