1 .\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
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
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.
28 .\" $FreeBSD: src/share/man/man3/pthread_attr.3,v 1.18 2007/10/22 10:08:00 ru Exp $
29 .\" $DragonFly: src/lib/libc_r/man/pthread_attr.3,v 1.2 2003/06/17 04:26:47 dillon Exp $
34 .Nm pthread_attr_init ,
35 .Nm pthread_attr_destroy ,
36 .Nm pthread_attr_setstack ,
37 .Nm pthread_attr_getstack ,
38 .Nm pthread_attr_setstacksize ,
39 .Nm pthread_attr_getstacksize ,
40 .Nm pthread_attr_setguardsize ,
41 .Nm pthread_attr_getguardsize ,
42 .Nm pthread_attr_setstackaddr ,
43 .Nm pthread_attr_getstackaddr ,
44 .Nm pthread_attr_setdetachstate ,
45 .Nm pthread_attr_getdetachstate ,
46 .Nm pthread_attr_setinheritsched ,
47 .Nm pthread_attr_getinheritsched ,
48 .Nm pthread_attr_setschedparam ,
49 .Nm pthread_attr_getschedparam ,
50 .Nm pthread_attr_setschedpolicy ,
51 .Nm pthread_attr_getschedpolicy ,
52 .Nm pthread_attr_setscope ,
53 .Nm pthread_attr_getscope
54 .Nd thread attribute operations
60 .Fn pthread_attr_init "pthread_attr_t *attr"
62 .Fn pthread_attr_destroy "pthread_attr_t *attr"
64 .Fn pthread_attr_setstack "pthread_attr_t *attr" "void *stackaddr" "size_t stacksize"
66 .Fn pthread_attr_getstack "const pthread_attr_t * restrict attr" "void ** restrict stackaddr" "size_t * restrict stacksize"
68 .Fn pthread_attr_setstacksize "pthread_attr_t *attr" "size_t stacksize"
70 .Fn pthread_attr_getstacksize "const pthread_attr_t *attr" "size_t *stacksize"
72 .Fn pthread_attr_setguardsize "pthread_attr_t *attr" "size_t guardsize"
74 .Fn pthread_attr_getguardsize "const pthread_attr_t *attr" "size_t *guardsize"
76 .Fn pthread_attr_setstackaddr "pthread_attr_t *attr" "void *stackaddr"
78 .Fn pthread_attr_getstackaddr "const pthread_attr_t *attr" "void **stackaddr"
80 .Fn pthread_attr_setdetachstate "pthread_attr_t *attr" "int detachstate"
82 .Fn pthread_attr_getdetachstate "const pthread_attr_t *attr" "int *detachstate"
84 .Fn pthread_attr_setinheritsched "pthread_attr_t *attr" "int inheritsched"
86 .Fn pthread_attr_getinheritsched "const pthread_attr_t *attr" "int *inheritsched"
88 .Fn pthread_attr_setschedparam "pthread_attr_t *attr" "const struct sched_param *param"
90 .Fn pthread_attr_getschedparam "const pthread_attr_t *attr" "struct sched_param *param"
92 .Fn pthread_attr_setschedpolicy "pthread_attr_t *attr" "int policy"
94 .Fn pthread_attr_getschedpolicy "const pthread_attr_t *attr" "int *policy"
96 .Fn pthread_attr_setscope "pthread_attr_t *attr" "int contentionscope"
98 .Fn pthread_attr_getscope "const pthread_attr_t *attr" "int *contentionscope"
100 Thread attributes are used to specify parameters to
102 One attribute object can be used in multiple calls to
104 with or without modifications between calls.
107 .Fn pthread_attr_init
110 with all the default thread attributes.
113 .Fn pthread_attr_destroy
118 .Fn pthread_attr_set*
119 functions set the attribute that corresponds to each function name.
122 .Fn pthread_attr_get*
123 functions copy the value of the attribute that corresponds to each function name
124 to the location pointed to by the second function parameter.
126 If successful, these functions return 0.
127 Otherwise, an error number is returned to indicate the error.
130 .Fn pthread_attr_init
131 function will fail if:
138 .Fn pthread_attr_destroy
139 function will fail if:
147 .Fn pthread_attr_setstacksize
149 .Fn pthread_attr_setstack
150 functions will fail if:
155 .Dv PTHREAD_STACK_MIN .
159 .Fn pthread_attr_setguardsize
161 .Fn pthread_attr_getguardsize
162 functions will fail if:
170 .Fn pthread_attr_setdetachstate
171 function will fail if:
179 .Fn pthread_attr_setinheritsched
180 function will fail if:
188 .Fn pthread_attr_setschedparam
189 function will fail if:
200 .Fn pthread_attr_setschedpolicy
201 function will fail if:
207 Invalid or unsupported value for
212 .Fn pthread_attr_setscope
213 function will fail if:
219 Invalid or unsupported value for
220 .Fa contentionscope .
223 .Xr pthread_attr_get_np 3 ,
227 .Fn pthread_attr_init ,
228 .Fn pthread_attr_destroy ,
229 .Fn pthread_attr_setstacksize ,
230 .Fn pthread_attr_getstacksize ,
231 .Fn pthread_attr_setstackaddr ,
232 .Fn pthread_attr_getstackaddr ,
233 .Fn pthread_attr_setdetachstate ,
235 .Fn pthread_attr_getdetachstate
240 .Fn pthread_attr_setinheritsched ,
241 .Fn pthread_attr_getinheritsched ,
242 .Fn pthread_attr_setschedparam ,
243 .Fn pthread_attr_getschedparam ,
244 .Fn pthread_attr_setschedpolicy ,
245 .Fn pthread_attr_getschedpolicy ,
246 .Fn pthread_attr_setscope ,
248 .Fn pthread_attr_getscope