pthread_attr_init()

initialize thread attribute object 

Function


SYNOPSIS

#include <pthread.h>

int pthread_attr_init(pthread_attr_t *attr);


DESCRIPTION

The pthread_attr_init() function initializes a thread attribute object with the default settings for each attribute, as follows:

Attribute Default Value Description
detachstate PTHREAD_CREATE_JOINABLE Thread may be joined by other threads.
inheritsched PTHREAD_INHERIT_SCHED Scheduling parameters, policy, and scope are inherited from creating thread.
schedparam Priority set to default for scheduling policy.
schedpolicy SCHED_OTHER Scheduling policy is determined by the system.
scope PTHREAD_SCOPE_SYSTEM Threads are scheduled system-wide.
stackaddr N/A Attribute not supported; address selected by OS.
stacksize 0 Stack size inherited from process stack size attribute.

A thread attribute object must be initialized prior to calling any of the pthread_attr_setXXX() functions.


PARAMETERS

attr 

Is the thread attribute object to be initialized


RETURN VALUES

On success, pthread_attr_init() returns 0. On error, one of the following values is returned:

ENOMEM 

Insufficient memory exists to create the thread attribute object.

EINVAL 

attr does not point to writable memory.

EFAULT 

attr is an invalid pointer.


CONFORMANCE

POSIX P1003.1 (1996)


MULTITHREAD SAFETY LEVEL

MT-safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
pthread_attr_destroy(), pthread_attr_getstacksize(), pthread_attr_setdetachstate(), pthread_attr_setinheritsched(), pthread_attr_setschedparam(), pthread_attr_setschedpolicy(), pthread_attr_setscope(), pthread_attr_setstackaddr(), pthread_create()


PTC MKS Toolkit 10.4 Documentation Build 39.