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