Initializes a thread attributes object.
pthread_attr_init( attr );
Argument Data Type Accessattr opaque pthread_attr_t write
#includeint pthread_attr_init ( pthread_attr_t *attr);
The following routines change the initialized individual attributes of a thread attributes object:
pthread_attr_setdetachstate pthread_attr_setguardsize_np pthread_attr_setinheritsched pthread_attr_setschedparam pthread_attr_setschedpolicy pthread_attr_setstacksize
The individual attributes (internal fields) of the attributes object are initialized to default values. The default values of each attribute are discussed in the descriptions of the thread attribute setting routines listed above.
When an attributes object is used to create a thread, the values of the individual attributes determine the characteristics of the new thread. Attributes objects act as additional arguments to thread creation. Changing individual attributes does not affect any threads that were previously created using the attributes object.
You can use a single attributes object in multiple calls to pthread_ create, from any thread. If multiple threads might change attributes in a shared attributes object, the application code must protect the integrity of the attributes object by using a mutex.
When you set the scheduling policy or scheduling parameters, or both, in an attributes object, you must disable scheduling inheritance if you want the scheduling attributes you set to be used at thread creation. To disable scheduling inheritance use the pthread_attr_setinheritsched routine, specifying the value PTHREAD_ EXPLICIT_SCHED for the inherit argument, before calling pthread_create.
Return Description0 Successful completion. [EINVAL] The value specified by attr is invalid. [ENOMEM] Insufficient memory exists to initialize the thread attributes object.
pthread_attr_destroy pthread_attr_setdetachstate pthread_attr_setguardsize_np pthread_attr_setinheritsched pthread_attr_setschedparam pthread_attr_setschedpolicy pthread_attr_setstacksize pthread_setguardsize_np pthread_create