]>
Commit | Line | Data |
---|---|---|
f1a1da6c A |
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 | .\" | |
2546420a A |
28 | .\" $FreeBSD$ |
29 | .Dd January 8, 2010 | |
f1a1da6c A |
30 | .Dt PTHREAD_ATTR 3 |
31 | .Os | |
32 | .Sh NAME | |
f1a1da6c | 33 | .Nm pthread_attr_init , |
2546420a A |
34 | .Nm pthread_attr_destroy , |
35 | .Nm pthread_attr_setstack , | |
36 | .Nm pthread_attr_getstack , | |
37 | .Nm pthread_attr_setguardsize , | |
38 | .Nm pthread_attr_getguardsize | |
f1a1da6c A |
39 | .Nd thread attribute operations |
40 | .Sh SYNOPSIS | |
2546420a A |
41 | .In pthread.h |
42 | .Ft int | |
43 | .Fn pthread_attr_init "pthread_attr_t *attr" | |
44 | .Ft int | |
45 | .Fn pthread_attr_destroy "pthread_attr_t *attr" | |
46 | .Ft int | |
47 | .Fn pthread_attr_setstack "pthread_attr_t *attr" " void *stackaddr" "size_t stacksize" | |
48 | .Ft int | |
49 | .Fn pthread_attr_getstack "const pthread_attr_t * restrict attr" "void ** restrict stackaddr" "size_t * restrict stacksize" | |
f1a1da6c | 50 | .Ft int |
2546420a | 51 | .Fn pthread_attr_setstacksize "pthread_attr_t *attr" "size_t stacksize" |
f1a1da6c | 52 | .Ft int |
2546420a | 53 | .Fn pthread_attr_getstacksize "const pthread_attr_t *attr" "size_t *stacksize" |
f1a1da6c | 54 | .Ft int |
2546420a | 55 | .Fn pthread_attr_setguardsize "pthread_attr_t *attr" "size_t guardsize" |
f1a1da6c | 56 | .Ft int |
2546420a | 57 | .Fn pthread_attr_getguardsize "const pthread_attr_t *attr" "size_t *guardsize" |
f1a1da6c | 58 | .Ft int |
2546420a | 59 | .Fn pthread_attr_setstackaddr "pthread_attr_t *attr" "void *stackaddr" |
f1a1da6c | 60 | .Ft int |
2546420a | 61 | .Fn pthread_attr_getstackaddr "const pthread_attr_t *attr" "void **stackaddr" |
f1a1da6c | 62 | .Ft int |
2546420a | 63 | .Fn pthread_attr_setdetachstate "pthread_attr_t *attr" "int detachstate" |
f1a1da6c | 64 | .Ft int |
2546420a | 65 | .Fn pthread_attr_getdetachstate "const pthread_attr_t *attr" "int *detachstate" |
f1a1da6c | 66 | .Ft int |
2546420a | 67 | .Fn pthread_attr_setinheritsched "pthread_attr_t *attr" "int inheritsched" |
f1a1da6c | 68 | .Ft int |
2546420a | 69 | .Fn pthread_attr_getinheritsched "const pthread_attr_t *attr" "int *inheritsched" |
f1a1da6c | 70 | .Ft int |
2546420a | 71 | .Fn pthread_attr_setschedparam "pthread_attr_t *attr" "const struct sched_param *param" |
f1a1da6c | 72 | .Ft int |
2546420a | 73 | .Fn pthread_attr_getschedparam "const pthread_attr_t *attr" "struct sched_param *param" |
f1a1da6c | 74 | .Ft int |
2546420a | 75 | .Fn pthread_attr_setschedpolicy "pthread_attr_t *attr" "int policy" |
f1a1da6c | 76 | .Ft int |
2546420a | 77 | .Fn pthread_attr_getschedpolicy "const pthread_attr_t *attr" "int *policy" |
f1a1da6c | 78 | .Ft int |
2546420a | 79 | .Fn pthread_attr_setscope "pthread_attr_t *attr" "int contentionscope" |
f1a1da6c | 80 | .Ft int |
2546420a | 81 | .Fn pthread_attr_getscope "const pthread_attr_t *attr" "int *contentionscope" |
f1a1da6c A |
82 | .Sh DESCRIPTION |
83 | Thread attributes are used to specify parameters to | |
84 | .Fn pthread_create . | |
85 | One attribute object can be used in multiple calls to | |
86 | .Fn pthread_create , | |
87 | with or without modifications between calls. | |
88 | .Pp | |
89 | The | |
90 | .Fn pthread_attr_init | |
91 | function initializes | |
92 | .Fa attr | |
93 | with all the default thread attributes. | |
94 | .Pp | |
95 | The | |
96 | .Fn pthread_attr_destroy | |
97 | function destroys | |
98 | .Fa attr . | |
99 | .Pp | |
100 | The | |
101 | .Fn pthread_attr_set* | |
102 | functions set the attribute that corresponds to each function name. | |
103 | .Pp | |
104 | The | |
105 | .Fn pthread_attr_get* | |
106 | functions copy the value of the attribute that corresponds to each function name | |
107 | to the location pointed to by the second function parameter. | |
108 | .Sh RETURN VALUES | |
109 | If successful, these functions return 0. | |
110 | Otherwise, an error number is returned to indicate the error. | |
111 | .Sh ERRORS | |
2546420a | 112 | The |
f1a1da6c | 113 | .Fn pthread_attr_init |
2546420a | 114 | function will fail if: |
f1a1da6c | 115 | .Bl -tag -width Er |
f1a1da6c A |
116 | .It Bq Er ENOMEM |
117 | Out of memory. | |
118 | .El | |
119 | .Pp | |
2546420a | 120 | The |
f1a1da6c | 121 | .Fn pthread_attr_destroy |
2546420a | 122 | function will fail if: |
f1a1da6c | 123 | .Bl -tag -width Er |
f1a1da6c A |
124 | .It Bq Er EINVAL |
125 | Invalid value for | |
126 | .Fa attr . | |
f1a1da6c A |
127 | .El |
128 | .Sh SEE ALSO | |
2546420a A |
129 | .Xr pthread_attr_affinity_np 3 , |
130 | .Xr pthread_attr_get_np 3 , | |
f1a1da6c A |
131 | .Xr pthread_create 3 |
132 | .Sh STANDARDS | |
133 | .Fn pthread_attr_init , | |
134 | .Fn pthread_attr_destroy , | |
135 | .Fn pthread_attr_setstacksize , | |
136 | .Fn pthread_attr_getstacksize , | |
137 | .Fn pthread_attr_setstackaddr , | |
138 | .Fn pthread_attr_getstackaddr , | |
139 | .Fn pthread_attr_setdetachstate , | |
140 | and | |
141 | .Fn pthread_attr_getdetachstate | |
2546420a | 142 | functions conform to |
f1a1da6c A |
143 | .St -p1003.1-96 |
144 | .Pp | |
2546420a | 145 | The |
f1a1da6c A |
146 | .Fn pthread_attr_setinheritsched , |
147 | .Fn pthread_attr_getinheritsched , | |
148 | .Fn pthread_attr_setschedparam , | |
149 | .Fn pthread_attr_getschedparam , | |
150 | .Fn pthread_attr_setschedpolicy , | |
151 | .Fn pthread_attr_getschedpolicy , | |
152 | .Fn pthread_attr_setscope , | |
153 | and | |
154 | .Fn pthread_attr_getscope | |
2546420a | 155 | functions conform to |
f1a1da6c | 156 | .St -susv2 |