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/lib/libc_r/man/pthread_attr.3,v 1.4.2.5 2001/08/17 15:42:51 ru Exp $
33 .Nm pthread_attr_destroy ,
34 .Nm pthread_attr_getdetachstate ,
35 .Nm pthread_attr_getinheritsched ,
36 .Nm pthread_attr_getschedparam ,
37 .Nm pthread_attr_getschedpolicy ,
38 .Nm pthread_attr_getscope ,
39 .Nm pthread_attr_getstackaddr ,
40 .Nm pthread_attr_getstacksize ,
41 .Nm pthread_attr_init ,
42 .Nm pthread_attr_setdetachstate ,
43 .Nm pthread_attr_setinheritsched ,
44 .Nm pthread_attr_setschedparam ,
45 .Nm pthread_attr_setschedpolicy ,
46 .Nm pthread_attr_setscope ,
47 .Nm pthread_attr_setstackaddr ,
48 .Nm pthread_attr_setstacksize
49 .Nd thread attribute operations
51 .Fd #include <pthread.h>
53 .Fo pthread_attr_destroy
54 .Fa "pthread_attr_t *attr"
57 .Fo pthread_attr_getdetachstate
58 .Fa "const pthread_attr_t *attr"
59 .Fa "int *detachstate"
62 .Fo pthread_attr_getinheritsched
63 .Fa "const pthread_attr_t *restrict attr"
64 .Fa "int *restrict inheritsched"
67 .Fo pthread_attr_getschedparam
68 .Fa "const pthread_attr_t *restrict attr"
69 .Fa "struct sched_param *restrict param"
72 .Fo pthread_attr_getschedpolicy
73 .Fa "const pthread_attr_t *restrict attr"
74 .Fa "int *restrict policy"
77 .Fo pthread_attr_getscope
78 .Fa "const pthread_attr_t *restrict attr"
79 .Fa "int *restrict contentionscope"
82 .Fo pthread_attr_getstackaddr
83 .Fa "const pthread_attr_t *restrict attr"
84 .Fa "void **restrict stackaddr"
87 .Fo pthread_attr_getstacksize
88 .Fa "const pthread_attr_t *restrict attr"
89 .Fa "size_t *restrict stacksize"
93 .Fa "pthread_attr_t *attr"
96 .Fo pthread_attr_setdetachstate
97 .Fa "pthread_attr_t *attr"
101 .Fo pthread_attr_setinheritsched
102 .Fa "pthread_attr_t *attr"
103 .Fa "int inheritsched"
106 .Fo pthread_attr_setschedparam
107 .Fa "pthread_attr_t *restrict attr"
108 .Fa "const struct sched_param *restrict param"
111 .Fo pthread_attr_setschedpolicy
112 .Fa "pthread_attr_t *attr"
116 .Fo pthread_attr_setscope
117 .Fa "pthread_attr_t *attr"
118 .Fa "int contentionscope"
121 .Fo pthread_attr_setstackaddr
122 .Fa "pthread_attr_t *attr"
123 .Fa "void *stackaddr"
126 .Fo pthread_attr_setstacksize
127 .Fa "pthread_attr_t *attr"
128 .Fa "size_t stacksize"
131 Thread attributes are used to specify parameters to
133 One attribute object can be used in multiple calls to
135 with or without modifications between calls.
138 .Fn pthread_attr_init
141 with all the default thread attributes.
144 .Fn pthread_attr_destroy
149 .Fn pthread_attr_set*
150 functions set the attribute that corresponds to each function name.
153 .Fn pthread_attr_get*
154 functions copy the value of the attribute that corresponds to each function name
155 to the location pointed to by the second function parameter.
157 If successful, these functions return 0.
158 Otherwise, an error number is returned to indicate the error.
160 .Fn pthread_attr_init
168 .Fn pthread_attr_destroy
177 .Fn pthread_attr_setstacksize
188 .Dv PTHREAD_STACK_MIN .
192 is not a multiple of the system page size.
195 .Fn pthread_attr_setdetachstate
206 .Fn pthread_attr_setinheritsched
215 .Fn pthread_attr_setschedparam
228 .Fn pthread_attr_setschedpolicy
236 Invalid or unsupported value for
240 .Fn pthread_attr_setscope
249 Invalid or unsupported value for
250 .Fa contentionscope .
255 .Fn pthread_attr_init ,
256 .Fn pthread_attr_destroy ,
257 .Fn pthread_attr_setstacksize ,
258 .Fn pthread_attr_getstacksize ,
259 .Fn pthread_attr_setstackaddr ,
260 .Fn pthread_attr_getstackaddr ,
261 .Fn pthread_attr_setdetachstate ,
263 .Fn pthread_attr_getdetachstate
267 .Fn pthread_attr_setinheritsched ,
268 .Fn pthread_attr_getinheritsched ,
269 .Fn pthread_attr_setschedparam ,
270 .Fn pthread_attr_getschedparam ,
271 .Fn pthread_attr_setschedpolicy ,
272 .Fn pthread_attr_getschedpolicy ,
273 .Fn pthread_attr_setscope ,
275 .Fn pthread_attr_getscope