[Previous] [Contents] [Next]

pthread_attr_init()

Initialize thread attribute object

Synopsis:

#include <pthread.h>

int pthread_attr_init( pthread_attr_t *attr );

Library:

libc

Description:

The pthread_attr_init() function initializes the thread attributes in the thread attribute object attr to their default values. After initialization, any attributes which need to be changed from their default value can be set using the pthread_attr_set() family of functions. The attribute object can then be passed to the pthread_create() function to create a thread with the required attributes. A single attribute object can be used in multiple calls to pthread_create().

The thread attributes and their default values are:

Attribute Default Value
detachstate PTHREAD_CREATE_JOINABLE
schedpolicy PTHREAD_INHERIT_SCHED
schedparam Inherited from parent thread
contentionscope PTHREAD_SCOPE_SYSTEM
stacksize 4K bytes
stackaddr NULL

Returns:

EOK
Success.

Classification:

POSIX 1003.1 (Threads)

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

pthread_attr_destroy(), pthread_create().


[Previous] [Contents] [Next]