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