Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > P


Pthread Library
HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


pthread_attr_init(), pthread_attr_destroy() — initialize or destroy a thread attributes object


#include <pthread.h> int pthread_attr_init( pthread_attr_t *attr ); int pthread_attr_destroy( pthread_attr_t *attr );



Pointer to the thread attributes object to be initialized or destroyed.


pthread_attr_init() initializes a thread attributes object attr with the default value for all the thread attributes.

When a thread attributes object is used to create a thread, the values of the individual attributes determine the characteristics of the new thread. Attributes objects act like additional parameters to object creation. A single attributes object can be used in multiple calls to pthread_create().

After a thread attributes object has been used to initialize one or more threads, any function affecting the attributes object does not affect the previously created threads.

The thread attributes and their default values are:


POSIX.1c does not define a default value. On HP-UX released on PA-RISC platforms, the default is 64K. On HP-UX released on Itanium(R)-based platforms, the default is 256K.


The default value is PAGESIZE bytes.


The default value is NULL.


The default value is PTHREAD_CREATE_JOINABLE.


POSIX.1c does not define a default value. The default value is set to PTHREAD_SCOPE_SYSTEM. The scope can also be specified externally by using the options listed in the pthread_scope_options(5) manpage.


POSIX.1c does not define a default value. On HP-UX, the default value is PTHREAD_INHERIT_SCHED.


POSIX.1c does not define a default value. On HP-UX, the default value is SCHED_TIMESHARE.


POSIX.1c does not define a default value.


The default value is PTHREAD_SPUINHERIT_NP.


The default value is PTHREAD_BIND_ADVISORY_NP.

If an initialized thread attributes object is reinitialized, the initialization results in undefined behavior.

pthread_attr_destroy() destroys the thread attributes object attr. The destroyed thread attributes object ceases to exist and its resources are reclaimed. Referencing the object after it has been destroyed results in undefined behavior. A destroyed thread attributes object can be reinitialized using thread attribute initialization routine pthread_attr_init().

Threads that have already been created using this attributes object are not affected by the destruction of the thread attributes object.


Upon successful completion, pthread_attr_init() and pthread_attr_destroy() return zero. Otherwise, an error number is returned to indicate the error (the errno variable is not set).


If any of the following occur, the pthread_attr_init() function returns the corresponding error number:


There is insufficient memory available in which to initialize the pthread attributes object.


The value specified by attr is invalid.

If any of the following occur, the pthread_attr_destroy() function returns the corresponding error number:


The value specified by attr is invalid.


pthread_attr_init() and pthread_attr_destroy() were derived from the IEEE POSIX P1003.1c standard.


pthread_attr_init(): POSIX 1003.1c. pthread_attr_destroy(): POSIX 1003.1c.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.