xref: /netbsd-src/lib/libpthread/pthread_rwlockattr.3 (revision b9737c740d1bf971e116770411f5c647354ad4e4)
1.\" $NetBSD: pthread_rwlockattr.3,v 1.10 2016/07/05 10:04:17 wiz Exp $
2.\"
3.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
14.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
15.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
17.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23.\" POSSIBILITY OF SUCH DAMAGE.
24.\"
25.\" Copyright (c) 1998 Alex Nash
26.\" All rights reserved.
27.\"
28.\" Redistribution and use in source and binary forms, with or without
29.\" modification, are permitted provided that the following conditions
30.\" are met:
31.\" 1. Redistributions of source code must retain the above copyright
32.\"    notice, this list of conditions and the following disclaimer.
33.\" 2. Redistributions in binary form must reproduce the above copyright
34.\"    notice, this list of conditions and the following disclaimer in the
35.\"    documentation and/or other materials provided with the distribution.
36.\"
37.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
38.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
39.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
40.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
41.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
42.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
43.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
45.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
46.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47.\" SUCH DAMAGE.
48.\"
49.\" $FreeBSD: src/lib/libpthread/man/pthread_rwlockattr_init.3,v 1.7 2002/09/16 19:29:29 mini Exp $
50.\"
51.Dd June 12, 2016
52.Dt PTHREAD_RWLOCKATTR 3
53.Os
54.Sh NAME
55.Nm pthread_rwlockattr_init ,
56.Nm pthread_rwlockattr_destroy ,
57.Nm pthread_rwlockattr_getpshared ,
58.Nm pthread_rwlockattr_setpshared
59.Nd initialize, destroy or query read/write lock attributes
60.Sh LIBRARY
61.Lb libpthread
62.Sh SYNOPSIS
63.In pthread.h
64.Ft int
65.Fn pthread_rwlockattr_init "pthread_rwlockattr_t *attr"
66.Ft int
67.Fn pthread_rwlockattr_destroy "pthread_rwlockattr_t *attr"
68.Ft int
69.Fn pthread_rwlockattr_getpshared "const pthread_rwlockattr_t *__restrict attr" "int * __restrict pshared"
70.Ft int
71.Fn pthread_rwlockattr_setpshared "pthread_rwlockattr_t *attr" "int pshared"
72.Sh DESCRIPTION
73The
74.Fn pthread_rwlockattr_init
75function is used to initialize a read/write lock attributes object.
76.Pp
77The
78.Fn pthread_rwlockattr_destroy
79function is used to destroy a read/write lock attribute object
80previously created with
81.Fn pthread_rwlockattr_init .
82.Pp
83The
84.Fn pthread_rwlockattr_getpshared
85function shall obtain the value of process-shared attribute from
86the initialized attributes object referenced by
87.Fa attr .
88.Pp
89The
90.Fn pthread_rwlockattr_setpshared
91function shall set the process-shared attribute in an initialized
92attributes object referenced by
93.Fa attr .
94.Sh RETURN VALUES
95If successful,
96all these functions return zero.
97Otherwise an error number will be returned to indicate the error.
98.Sh ERRORS
99.Fn pthread_rwlockattr_init
100shall fail if:
101.Bl -tag -width Er
102.It Bq Er ENOMEM
103Insufficient memory exists to initialize the read/write lock attributes object.
104.El
105.Pp
106.Fn pthread_rwlockattr_init
107and
108.Fn pthread_rwlockattr_destroy
109may fail if:
110.Bl -tag -width Er
111.It Bq Er EINVAL
112The value specified by
113.Fa attr
114is invalid.
115.El
116.Pp
117.Fn pthread_rwlockattr_getpshared
118and
119.Fn pthread_rwlockattr_setpshared
120may fail if:
121.Bl -tag -width Er
122.It Bq Er EINVAL
123The value specified by
124.Fa attr
125is invalid.
126.El
127.Sh SEE ALSO
128.Xr pthread_rwlock_init 3
129.Sh STANDARDS
130Both functions conform to
131.St -p1003.1-2001 .
132.Sh BUGS
133The
134.Fn pthread_rwlockattr_getpshared
135and
136.Fn pthread_rwlockattr_setpshared
137functions are hidden by default since only thread shared attributes
138are supported.
139