pthread_attr_init(3pthread)


pthread_attr_init, pthread_attr_destroy -- initialise and destroy threads attribute object

Synopsis

cc [options] -Kthread file

#include <pthread.h>

int pthread_attr_init(pthread_attr_t *attr); int pthread_attr_destroy(pthread_attr_t *attr);

Description

pthread_attr_init initialises a thread attributes object attr with the default value for all of the individual attributes. Default values defined are PTHREAD_CREATE_JOINABLE, PTHREAD_SCOPE_PROCESS and PTHREAD_INHERIT_SCHED

The resulting attribute object (possibly modified by setting individual attribute values), when used by pthread_create(3pthread) defines the attributes of the thread created. A single attributes object can be used in multiple simultaneous calls to pthread_create.

pthread_attr_destroy is used to destroy a thread attributes object. An attempt to use an attribute after it has been destroyed will generally cause an error.

Return values

Upon successful completion, pthread_attr_init and pthread_attr_destroy return a value of 0. Otherwise, an error number is returned to indicate the error.

Diagnostics

If the follwing condition is detected, pthread_attr_init will return the corresponding value:

ENOMEM
insufficient memory to initialise the thread attributes object

References

pthread_attr_setstackaddr(3pthread), pthread_attr_setstacksize(3pthread), pthread_attr_setdetachstate(3pthread), pthread_attr_setinheritsched(3pthread), pthread_attr_setschedparam(3pthread), pthread_attr_setscope(3pthread), pthread_create(3pthread), pthread_create(3pthread), pthread_create(3pthread), pthread_create(3pthread), pthread(4)

Standards compliance

The Single UNIX Specification, Version 2; The Open Group.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004