Gets and sets the scope attribute in the attr object.
Threads Library (libpthreads.a)
#include <pthread.h>
int pthread_attr_setscope (attr, contentionscope)
pthread_attr_t *attr;
int contentionscope;
int pthread_attr_getscope (attr, contentionscope)
const pthread_attr_t *attr;
int *contentionscope;
The scope attribute controls whether a thread is created in system or process scope.
The pthread_attr_getscope and pthread_attr_setscope subroutines get and set the scope attribute in the attr object.
The scope can be set to PTHREAD_SCOPE_SYSTEM or PTHREAD_SCOPE_PROCESS. A value of PTHREAD_SCOPE_SYSTEM causes all threads created with the attr parameter to be in system scope, whereas a value of PTHREAD_SCOPE_PROCESS causes all threads created with the attr parameter to be in process scope.
The default value of the contentionscope parameter is PTHREAD_SCOPE_SYSTEM.
Item | Description |
---|---|
attr | Specifies the thread attributes object. |
contentionscope | Points to where the scope attribute value will be stored. |
Upon successful completion, the pthread_attr_getscope and pthread_attr_setscope subroutines return a value of 0. Otherwise, an error number is returned to indicate the error.
Item | Description |
---|---|
EINVAL | The value of the attribute being set/read is not valid. |
ENOTSUP | An attempt was made to set the attribute to an unsupported value. |