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