xref: /openbsd-src/lib/libpthread/man/pthread_mutexattr.3 (revision b2ea75c1b17e1a9a339660e7ed45cd24946b230e)
1.\" $OpenBSD: pthread_mutexattr.3,v 1.1 2001/08/04 13:56:19 fgsch Exp $
2.\" Copyright (C) 2000 Jason Evans <jasone@freebsd.org>.
3.\" All rights reserved.
4.\"
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(s), this list of conditions and the following disclaimer as
10.\"    the first lines of this file unmodified other than the possible
11.\"    addition of one or more copyright notices.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice(s), this list of conditions and the following disclaimer in
14.\"    the documentation and/or other materials provided with the
15.\"    distribution.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
18.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
21.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28.\"
29.\" $FreeBSD: pthread_mutexattr.3,v 1.5 2001/07/15 07:53:26 dd Exp $
30.Dd May 1, 2000
31.Dt PTHREAD_MUTEXATTR 3
32.Os
33.Sh NAME
34.Nm pthread_mutexattr_init ,
35.Nm pthread_mutexattr_destroy ,
36.Nm pthread_mutexattr_setprioceiling ,
37.Nm pthread_mutexattr_getprioceiling ,
38.Nm pthread_mutexattr_setprotocol ,
39.Nm pthread_mutexattr_getprotocol ,
40.Nm pthread_mutexattr_settype ,
41.Nm pthread_mutexattr_gettype
42.Nd mutex attribute operations
43.Sh SYNOPSIS
44.Fd #include <pthread.h>
45.Ft int
46.Fn pthread_mutexattr_init "pthread_mutexattr_t *attr"
47.Ft int
48.Fn pthread_mutexattr_destroy "pthread_mutexattr_t *attr"
49.Ft int
50.Fn pthread_mutexattr_setprioceiling "pthread_mutexattr_t *attr" "int prioceiling"
51.Ft int
52.Fn pthread_mutexattr_getprioceiling "pthread_mutexattr_t *attr" "int *prioceiling"
53.Ft int
54.Fn pthread_mutexattr_setprotocol "pthread_mutexattr_t *attr" "int protocol"
55.Ft int
56.Fn pthread_mutexattr_getprotocol "pthread_mutexattr_t *attr" "int *protocol"
57.Ft int
58.Fn pthread_mutexattr_settype "pthread_mutexattr_t *attr" "int type"
59.Ft int
60.Fn pthread_mutexattr_gettype "pthread_mutexattr_t *attr" "int *type"
61.Sh DESCRIPTION
62Mutex attributes are used to specify parameters to
63.Fn pthread_mutex_init .
64One attribute object can be used in multiple calls to
65.Fn pthread_mutex_init ,
66with or without modifications between calls.
67.Pp
68The
69.Fn pthread_mutexattr_init
70function initializes
71.Fa attr
72with all the default mutex attributes.
73.Pp
74The
75.Fn pthread_mutexattr_destroy
76function destroys
77.Fa attr .
78.Pp
79The
80.Fn pthread_mutexattr_set*
81functions set the attribute that corresponds to each function name.
82.Pp
83The
84.Fn pthread_mutexattr_get*
85functions copy the value of the attribute that corresponds to each function name
86to the location pointed to by the second function parameter.
87.Sh RETURN VALUES
88If successful, these functions return 0.
89Otherwise, an error number is returned to indicacte the error.
90.Sh ERRORS
91.Fn pthread_mutexattr_init
92will fail if:
93.Bl -tag -width Er
94.It Bq Er ENOMEM
95Out of memory.
96.El
97.Pp
98.Fn pthread_mutexattr_destroy
99will fail if:
100.Bl -tag -width Er
101.It Bq Er EINVAL
102Invalid value for
103.Fa attr .
104.El
105.Pp
106.Fn pthread_mutexattr_setprioceiling
107will fail if:
108.Bl -tag -width Er
109.It Bq Er EINVAL
110Invalid value for
111.Fa attr ,
112or invalid value for
113.Fa prioceiling .
114.El
115.Pp
116.Fn pthread_mutexattr_getprioceiling
117will fail if:
118.Bl -tag -width Er
119.It Bq Er EINVAL
120Invalid value for
121.Fa attr .
122.El
123.Pp
124.Fn pthread_mutexattr_setprotocol
125will fail if:
126.Bl -tag -width Er
127.It Bq Er EINVAL
128Invalid value for
129.Fa attr ,
130or invalid value for
131.Fa protocol .
132.El
133.Pp
134.Fn pthread_mutexattr_getprotocol
135will fail if:
136.Bl -tag -width Er
137.It Bq Er EINVAL
138Invalid value for
139.Fa attr .
140.El
141.Pp
142.Fn pthread_mutexattr_settype
143will fail if:
144.Bl -tag -width Er
145.It Bq Er EINVAL
146Invalid value for
147.Fa attr ,
148or invalid value for
149.Fa type .
150.El
151.Pp
152.Fn pthread_mutexattr_gettype
153will fail if:
154.Bl -tag -width Er
155.It Bq Er EINVAL
156Invalid value for
157.Fa attr .
158.El
159.Sh SEE ALSO
160.Xr pthread_mutex_init 3
161.Sh STANDARDS
162.Fn pthread_mutexattr_init
163and
164.Fn pthread_mutexattr_destroy
165conforms to ISO/IEC 9945-1 ANSI/IEEE
166.Pq Dq Tn POSIX
167Std 1003.1 Second Edition 1996-07-12.
168.Pp
169.Fn pthread_mutexattr_setprioceiling ,
170.Fn pthread_mutexattr_getprioceiling ,
171.Fn pthread_mutexattr_setprotocol ,
172.Fn pthread_mutexattr_getprotocol ,
173.Fn pthread_mutexattr_settype ,
174and
175.Fn pthread_mutexattr_gettype
176conform to
177.St -susv2
178