Creates a thread attributes object and initializes it with default values.
Threads Library (libpthreads.a)
#include <pthread.h>
int pthread_attr_init ( attr)
pthread_attr_t *attr;
The pthread_attr_init subroutine creates a new thread attributes object attr. The new thread attributes object is initialized with the following default values:
Attribute | Default value |
---|---|
Detachstate | PTHREAD_CREATE_JOINABLE |
Contention-scope | PTHREAD_SCOPE_PROCESS the default ensures compatibility with implementations that do not support this POSIX option. |
Inheritsched | PTHREAD_INHERITSCHED |
Schedparam | A sched_param structure which sched_prio field is set to 1, the least favored priority. |
Schedpolicy | SCHED_OTHER |
Stacksize | PTHREAD_STACK_MIN |
Guardsize | PAGESIZE |
The resulting attribute object (possibly modified by setting individual attribute values), when used by pthread_create, defines the attributes of the thread created. A single attributes object can be used in multiple simultaneous calls to pthread_create.
attr | Specifies the thread attributes object to be created. |
Upon successful completion, the new thread attributes object is filled with default values and returned via the attr parameter, and 0 is returned. Otherwise, an error code is returned.
The pthread_attr_init subroutine is unsuccessful if the following is true:
EINVAL | The attr parameter is not valid. |
ENOMEM | There is not sufficient memory to create the thread attribute object. |
This function will not return an error code of [EINTR].
The pthread_attr_setdetachstate (pthread_attr_getdetachstate or pthread_attr_setdetachstate Subroutines) subroutine, pthread_attr_setstackaddr (pthread_attr_setstackaddr Subroutine) subroutine, pthread_attr_setstacksize (pthread_attr_setstacksize Subroutine) subroutine, pthread_create (pthread_create Subroutine) subroutine, pthread_attr_destroy (pthread_attr_destroy Subroutine) subroutine, pthread_attr_setguardsize (pthread_attr_getguardsize or pthread_attr_setguardsize Subroutines) subroutine.
The pthread.h file.
Creating Threads in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
Threads Library Options and Threads Library Quick Reference in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.