9103 opengroup acknowledgement should be properly formatted in man pages
[unleashed.git] / usr / src / man / man3c / pthread_attr_init.3c
blob473f9b3de1d44f7e4218bb3f6d49896d7e6262b7
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright 1991, 1992, 1994, The X/Open Company Ltd.  All Rights Reserved.
44 .\" Copyright (c) 2001, The IEEE and The Open Group.  All Rights Reserved.
45 .\" Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved.
46 .\"
47 .TH PTHREAD_ATTR_INIT 3C "Dec 10, 2015"
48 .SH NAME
49 pthread_attr_init, pthread_attr_destroy \- initialize or destroy threads
50 attribute object
51 .SH SYNOPSIS
52 .LP
53 .nf
54 cc -mt [ \fIflag\fR... ] \fIfile\fR... -lpthread [ \fIlibrary\fR... ]
55 #include <pthread.h>
57 \fBint\fR \fBpthread_attr_init\fR(\fBpthread_attr_t *\fR\fIattr\fR);
58 .fi
60 .LP
61 .nf
62 \fBint\fR \fBpthread_attr_destroy\fR(\fBpthread_attr_t *\fR\fIattr\fR);
63 .fi
65 .SH DESCRIPTION
66 .LP
67 The function \fBpthread_attr_init()\fR initializes a thread attributes object
68 \fIattr\fR with the default value for all of the individual attributes used by
69 a given implementation.
70 .sp
71 .LP
72 The resulting attribute object (possibly modified by setting individual
73 attribute values), when used by \fBpthread_create()\fR, defines the attributes
74 of the thread created. A single attributes object can be used in multiple
75 simultaneous calls to \fBpthread_create()\fR.
76 .sp
77 .LP
78 The \fBpthread_attr_init()\fR function initializes a thread attributes object (
79 \fIattr\fR) with the default value for each attribute as follows:
80 .sp
82 .sp
83 .TS
84 c c c
85 l l l .
86 Attribute       Default Value   Meaning of Default
88 \fIcontentionscope\fR   \fBPTHREAD_SCOPE_PROCESS\fR     resource competition within process
89 \fIdetachstate\fR       \fBPTHREAD_CREATE_JOINABLE\fR   joinable by other threads
90 \fIstackaddr\fR \fBNULL\fR      stack allocated by system
91 \fIstacksize\fR 0       1 or 2 megabyte
92 \fIpriority\fR  0       priority of the thread
93 \fIpolicy\fR    \fBSCHED_OTHER\fR       traditional time-sharing policy
94 \fIinheritsched\fR      \fBPTHREAD_INHERIT_SCHED\fR     T{
95 scheduling policy and parameters are inherited from the creating thread
97 \fIguardsize\fR \fBPAGESIZE\fR  T{
98 size of guard area for a thread's created stack
104 The \fBpthread_attr_destroy()\fR function destroys a thread attributes object (
105 \fIattr\fR), which cannot be reused until it is reinitialized. An
106 implementation may cause \fBpthread_attr_destroy()\fR to set \fIattr\fR to an
107 implementation-dependent invalid value. The behavior of using the attribute
108 after it has been destroyed is undefined.
109 .SH RETURN VALUES
111 Upon successful completion, \fBpthread_attr_init()\fR and
112 \fBpthread_attr_destroy()\fR return a value of  \fB0\fR. Otherwise, an error
113 number is returned to indicate the error.
114 .SH ERRORS
116 The  \fBpthread_attr_init()\fR function will fail if:
118 .ne 2
120 \fB\fBENOMEM\fR\fR
122 .RS 10n
123 Insufficient memory exists to initialize the thread attributes object.
128 The  \fBpthread_attr_destroy()\fR function may fail if:
130 .ne 2
132 \fB\fBEINVAL\fR\fR
134 .RS 10n
135 \fIattr\fR is invalid.
138 .SH ATTRIBUTES
140 See \fBattributes\fR(5) for descriptions of the following attributes:
145 box;
146 c | c
147 l | l .
148 ATTRIBUTE TYPE  ATTRIBUTE VALUE
150 Interface Stability     Committed
152 MT-Level        MT-Safe
154 Standard        See \fBstandards\fR(5).
157 .SH SEE ALSO
159 \fBsysconf\fR(3C), \fBpthread_attr_getdetachstate\fR(3C),
160 \fBpthread_attr_get_np\fR(3C),
161 \fBpthread_attr_getguardsize\fR(3C), \fBpthread_attr_getinheritsched\fR(3C),
162 \fBpthread_attr_getschedparam\fR(3C), \fBpthread_attr_getschedpolicy\fR(3C),
163 \fBpthread_attr_getscope\fR(3C), \fBpthread_attr_getstackaddr\fR(3C),
164 \fBpthread_attr_getstacksize\fR(3C), \fBpthread_attr_setdetachstate\fR(3C),
165 \fBpthread_attr_setguardsize\fR(3C), \fBpthread_attr_setinheritsched\fR(3C),
166 \fBpthread_attr_setschedparam\fR(3C), \fBpthread_attr_setschedpolicy\fR(3C),
167 \fBpthread_attr_setscope\fR(3C), \fBpthread_attr_setstackaddr\fR(3C),
168 \fBpthread_attr_setstacksize\fR(3C), \fBpthread_create\fR(3C),
169 \fBattributes\fR(5), \fBstandards\fR(5)