[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1

pthread_attr_getscope and pthread_attr_setscope Subroutines

Purpose

Gets and sets the scope attribute in the attr object.

Library

Threads Library (libpthreads.a)

Syntax

#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;

Description

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_PROCESS.

Parameters

attr Specifies the thread attributes object.
contentionscope Points to where the scope attribute value will be stored.

Return Values

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.

Error Codes

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.

Related Information

The pthread_create Subroutine, and pthread_attr_init Subroutine.

The pthread.h file in AIX 5L Version 5.2 Files Reference

Creating Threads and Threads Library Quick Reference in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]