HP-UX Reference (11i v1 05/09) - 3 Library Functions N-Z (vol 7)
p
pthread_attr_init(3T) pthread_attr_init(3T)
(Pthread Library)
NAME
pthread_attr_init(), pthread_attr_destroy() - initialize or destroy a thread attributes object.
SYNOPSIS
#include <pthread.h>
int pthread_attr_init(
pthread_attr_t *attr
);
int pthread_attr_destroy(
pthread_attr_t *attr
);
PARAMETERS
attr Pointer to the thread attributes object to be initialized or destroyed.
DESCRIPTION
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:
stacksize POSIX.1c does not define a default value. On HP-UX release 10.30, the default
value is 64K.
guardsize The default value is PAGESIZE bytes.
stackaddr The default value is NULL.
detachstate The default value is PTHREAD_CREATE_JOINABLE
.
contentionscope
POSIX.1c does not define a default value. On HP-UX release 10.30, the current
default value is PTHREAD_SCOPE_SYSTEM
. Note: This default value will
change to
PTHREAD_SCOPE_PROCESS
when HP-UX supports the MxN
Threads Model.
inheritsched POSIX.1c does not define a default value. On HP-UX, the default value is
PTHREAD_INHERIT_SCHED
.
schedpolicy POSIX.1c does not define a default value. On HP-UX, the default value is
SCHED_TIMESHARE.
schedparam POSIX.1c does not define a default value.
processor The default value is PTHREAD_SPUINHERIT_NP.
binding_type 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 attri-
bute 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.
RETURN VALUE
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).
HP-UX 11i Version 1: September 2005 − 1 − Hewlett-Packard Company Section 3−−687