pthread_getattr_np

Name

pthread_getattr_np -- get thread attributes

Synopsis

#include <pthread.h>

int pthread_getattr_np(pthread_t thread, pthread_attr_t *attr);

Description

pthread_getattr_np() fills in the thread attribute object attr with attribute values describing the running thread thread. This is useful to detect runtime changes from the values specified in the thread attributes object used to create the thread with pthread_create(). The following differences may be noted:

If the stack address attribute was not set in the thread attributes object used to create the thread, then the thread attributes object returned by pthread_getattr_np() will show the actual stack address the implementation selected for the thread. Use pthread_attr_getstack() to extract from attr.

The thread attributes object attr should be destroyed using pthread_attr_destroy() when it is no longer needed.

Return Value

On success, pthread_getattr_np() returns 0; on error, it returns a non-zero error number.

Errors

ENOMEM 

Insufficient memory to complete the operation.

In addition, if thread refers to the main thread, then pthread_getattr_np() may also fail due to errors from various underlying calls: fopen(), if the pseudo-file containing the memory region map cannot be opened; getrlimit() if the RLIMIT_STACK resource limit it not supported.

Notes

This function is a GNU extension.

See Also

pthread_attr_destroy(), pthread_attr_getdetachstate(), pthread_attr_getguardsize(), pthread_attr_getstack(), pthread_create().