Deleted Added
full compact
rwlock.9 (177846) rwlock.9 (227588)
1.\" Copyright (c) 2006 Gleb Smirnoff <glebius@FreeBSD.org>
2.\" 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, this list of conditions and the following disclaimer.

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

17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
1.\" Copyright (c) 2006 Gleb Smirnoff <glebius@FreeBSD.org>
2.\" 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, this list of conditions and the following disclaimer.

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

17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD: head/share/man/man9/rwlock.9 177846 2008-04-01 20:56:45Z attilio $
25.\" $FreeBSD: head/share/man/man9/rwlock.9 227588 2011-11-16 21:51:17Z pjd $
26.\"
26.\"
27.Dd April 1, 2008
27.Dd November 16, 2011
28.Dt RWLOCK 9
29.Os
30.Sh NAME
31.Nm rwlock ,
32.Nm rw_init ,
33.Nm rw_init_flags,
34.Nm rw_destroy ,
35.Nm rw_rlock ,

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

73.Fn rw_unlock "struct rwlock *rw"
74.Ft int
75.Fn rw_try_upgrade "struct rwlock *rw"
76.Ft void
77.Fn rw_downgrade "struct rwlock *rw"
78.Ft int
79.Fn rw_sleep "void *chan" "struct rwlock *rw" "int priority" "const char *wmesg" "int timo"
80.Ft int
28.Dt RWLOCK 9
29.Os
30.Sh NAME
31.Nm rwlock ,
32.Nm rw_init ,
33.Nm rw_init_flags,
34.Nm rw_destroy ,
35.Nm rw_rlock ,

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

73.Fn rw_unlock "struct rwlock *rw"
74.Ft int
75.Fn rw_try_upgrade "struct rwlock *rw"
76.Ft void
77.Fn rw_downgrade "struct rwlock *rw"
78.Ft int
79.Fn rw_sleep "void *chan" "struct rwlock *rw" "int priority" "const char *wmesg" "int timo"
80.Ft int
81.Fn rw_initialized "struct rwlock *rw"
81.Fn rw_initialized "const struct rwlock *rw"
82.Ft int
82.Ft int
83.Fn rw_wowned "struct rwlock *rw"
83.Fn rw_wowned "const struct rwlock *rw"
84.Pp
85.Cd "options INVARIANTS"
86.Cd "options INVARIANT_SUPPORT"
87.Ft void
84.Pp
85.Cd "options INVARIANTS"
86.Cd "options INVARIANT_SUPPORT"
87.Ft void
88.Fn rw_assert "struct rwlock *rw" "int what"
88.Fn rw_assert "const struct rwlock *rw" "int what"
89.In sys/kernel.h
90.Fn RW_SYSINIT "name" "struct rwlock *rw" "const char *desc"
91.Sh DESCRIPTION
92Reader/writer locks allow shared access to protected data by multiple threads,
93or exclusive access by a single thread.
94The threads with shared access are known as
95.Em readers
96since they only read the protected data.

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

226.Fa rw .
227.It Fn rw_sleep "void *chan" "struct rwlock *rw" "int priority" "const char *wmesg" "int timo"
228Atomically release
229.Fa rw
230while waiting for an event.
231For more details on the parameters to this function,
232see
233.Xr sleep 9 .
89.In sys/kernel.h
90.Fn RW_SYSINIT "name" "struct rwlock *rw" "const char *desc"
91.Sh DESCRIPTION
92Reader/writer locks allow shared access to protected data by multiple threads,
93or exclusive access by a single thread.
94The threads with shared access are known as
95.Em readers
96since they only read the protected data.

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

226.Fa rw .
227.It Fn rw_sleep "void *chan" "struct rwlock *rw" "int priority" "const char *wmesg" "int timo"
228Atomically release
229.Fa rw
230while waiting for an event.
231For more details on the parameters to this function,
232see
233.Xr sleep 9 .
234.It Fn rw_initialized "struct rwlock *rw"
234.It Fn rw_initialized "const struct rwlock *rw"
235This function returns non-zero if
236.Fa rw
237has been initialized, and zero otherwise.
238.It Fn rw_destroy "struct rwlock *rw"
239This functions destroys a lock previously initialized with
240.Fn rw_init .
241The
242.Fa rw
243lock must be unlocked.
235This function returns non-zero if
236.Fa rw
237has been initialized, and zero otherwise.
238.It Fn rw_destroy "struct rwlock *rw"
239This functions destroys a lock previously initialized with
240.Fn rw_init .
241The
242.Fa rw
243lock must be unlocked.
244.It Fn rw_wowned "struct rwlock *rw"
244.It Fn rw_wowned "const struct rwlock *rw"
245This function returns a non-zero value if the current thread owns an
246exclusive lock on
247.Fa rw .
245This function returns a non-zero value if the current thread owns an
246exclusive lock on
247.Fa rw .
248.It Fn rw_assert "struct rwlock *rw" "int what"
248.It Fn rw_assert "const struct rwlock *rw" "int what"
249This function allows assertions specified in
250.Fa what
251to be made about
252.Fa rw .
253If the assertions are not true and the kernel is compiled
254with
255.Cd "options INVARIANTS"
256and

--- 57 unchanged lines hidden ---
249This function allows assertions specified in
250.Fa what
251to be made about
252.Fa rw .
253If the assertions are not true and the kernel is compiled
254with
255.Cd "options INVARIANTS"
256and

--- 57 unchanged lines hidden ---