1pthread_attr_init(3C)    Standard C Library Functions    pthread_attr_init(3C)
2
3
4

NAME

6       pthread_attr_init, pthread_attr_destroy - initialize or destroy threads
7       attribute object
8

SYNOPSIS

10       cc -mt [ flag... ] file... -lpthread [ library... ]
11       #include <pthread.h>
12
13       int pthread_attr_init(pthread_attr_t *attr);
14
15
16       int pthread_attr_destroy(pthread_attr_t *attr);
17
18

DESCRIPTION

20       The function pthread_attr_init() initializes a thread attributes object
21       attr  with  the default value for all of the individual attributes used
22       by a given implementation.
23
24
25       The resulting attribute object (possibly modified by setting individual
26       attribute   values),   when   used  by  pthread_create(),  defines  the
27       attributes of the thread created. A single  attributes  object  can  be
28       used in multiple simultaneous calls to pthread_create().
29
30
31       The pthread_attr_init() function initializes a thread attributes object
32       ( attr) with the default value for each attribute as follows:
33
34
35
36
37           Attribute             Default Value                Meaning of Default
38       ───────────────────────────────────────────────────────────────────────────────────
39       contentionscope      PTHREAD_SCOPE_PROCESS     resource competition within process
40       detachstate          PTHREAD_CREATE_JOINABLE   joinable by other threads
41       stackaddr            NULL                      stack allocated by system
42       stacksize            0                         1 or 2 megabyte
43       priority             0                         priority of the thread
44       policy               SCHED_OTHER               traditional time-sharing policy
45       inheritsched         PTHREAD_INHERIT_SCHED     scheduling  policy  and  parameters
46                                                      are  inherited  from  the  creating
47                                                      thread
48       guardsize            PAGESIZE                  size of guard area for  a  thread's
49                                                      created stack
50
51
52
53       The pthread_attr_destroy() function destroys a thread attributes object
54       ( attr), which cannot be reused until it is reinitialized. An implemen‐
55       tation  may  cause pthread_attr_destroy() to set attr to an implementa‐
56       tion-dependent invalid value. The behavior of using the attribute after
57       it has been destroyed is undefined.
58

RETURN VALUES

60       Upon      successful      completion,      pthread_attr_init()      and
61       pthread_attr_destroy() return a value of  0. Otherwise, an error number
62       is returned to indicate the error.
63

ERRORS

65       The  pthread_attr_init() function will fail if:
66
67       ENOMEM    Insufficient   memory   exists   to   initialize  the  thread
68                 attributes object.
69
70
71
72       The  pthread_attr_destroy() function may fail if:
73
74       EINVAL    attr is invalid.
75
76

ATTRIBUTES

78       See attributes(5) for descriptions of the following attributes:
79
80
81
82
83       ┌─────────────────────────────┬─────────────────────────────┐
84       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
85       ├─────────────────────────────┼─────────────────────────────┤
86       │Interface Stability          │Committed                    │
87       ├─────────────────────────────┼─────────────────────────────┤
88       │MT-Level                     │MT-Safe                      │
89       ├─────────────────────────────┼─────────────────────────────┤
90       │Standard                     │See standards(5).            │
91       └─────────────────────────────┴─────────────────────────────┘
92

SEE ALSO

94       sysconf(3C),  pthread_attr_getdetachstate(3C),   pthread_attr_getguard‐
95       size(3C),    pthread_attr_getinheritsched(3C),   pthread_attr_getsched‐
96       param(3C), pthread_attr_getschedpolicy(3C),  pthread_attr_getscope(3C),
97       pthread_attr_getstackaddr(3C),           pthread_attr_getstacksize(3C),
98       pthread_attr_setdetachstate(3C),         pthread_attr_setguardsize(3C),
99       pthread_attr_setinheritsched(3C),       pthread_attr_setschedparam(3C),
100       pthread_attr_setschedpolicy(3C),             pthread_attr_setscope(3C),
101       pthread_attr_setstackaddr(3C),           pthread_attr_setstacksize(3C),
102       pthread_create(3C), attributes(5), standards(5)
103
104
105
106SunOS 5.11                        1 Apr 2008             pthread_attr_init(3C)
Impressum