Middleware, development tools, realtime operating system
software and services for superior embedded design


Home
QNX Community Resources
Developer Support
QNX Documentation Library
QNX Developer Support

QNX Developer Support

QNX Software Systems
Developer Resources
Blogs
Board support packages
Foundry27 projects
Forums
Hardware support listing
Online video tutorials
Product documentation
Technical Articles

[Previous] [Contents] [Index] [Next]

pthread_attr_init()

Initialize a thread-attribute object

Synopsis:

#include <pthread.h>

int pthread_attr_init( pthread_attr_t *attr );

Arguments:

attr
A pointer to the pthread_attr_t structure that you want to initialize. For more information, see below.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The pthread_attr_init() function initializes the thread attributes in the thread attribute object attr to their default values:

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

After initialization, you can use the pthread_attr_* family of functions to get and set the attributes:

Get Set
pthread_attr_getdetachstate()
pthread_attr_setdetachstate()
pthread_attr_getguardsize()
pthread_attr_setguardsize()
pthread_attr_getinheritsched()
pthread_attr_setinheritsched()
pthread_attr_getschedparam()
pthread_attr_setschedparam()
pthread_attr_getschedpolicy()
pthread_attr_setschedpolicy()
pthread_attr_getscope()
pthread_attr_setscope()
pthread_attr_getstackaddr()
pthread_attr_setstackaddr()
pthread_attr_getstacklazy()
pthread_attr_setstacklazy()
pthread_attr_getstacksize()
pthread_attr_setstacksize()

You can also set some non-POSIX attributes; for more information, see "QNX extensions," in the documentation for pthread_create().

You can then pass the attribute object to pthread_create() to create a thread with the required attributes. You can use the same attribute object in multiple calls to pthread_create().

The effect of initializing an already-initialized thread-attribute object is undefined.

Returns:

EOK
Success.

Classification:

POSIX 1003.1 THR

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

See also:

pthread_attr_destroy(), pthread_create()


[Previous] [Contents] [Index] [Next]