pthread_attr_getscope Subroutine



Purpose

Returns the value of the contention-scope attribute of a thread attributes
object.

Library

Threads Library (libpthreads.a)

Syntax

#include 

int pthread_attr_getscope (attr, scope)
const pthread_attr_t *attr;
int *scope;

Description

The pthread_attr_getscope subroutine returns the value of the contention-scope
attribute of the thread attributes object attr. This attribute specifies
the contention scope of a thread created with this attributes object.
It may have one of the following values:

PTHREAD_SCOPE_PROCESS	Specifes process (local) contention scope; the
thread will be scheduled against other local contention scope threads
in the same process.

PTHREAD_SCOPE_SYSTEM	Specifies system (global) contention scope; the
thread will be scheduled against all other threads. This is the default
value.

Note:	The pthread.h header file must be the first included file of
each source file using the threads library.

Parameters

attr	Specifies the thread attributes object.

scope	Points to where the contention-scope attribute value will be
stored.

Return Values

Upon successful completion, the value of the contention-scope attribute
is returned via the scope parameter, and 0 is returned. Otherwise,
an error code is returned.

Error Codes

The pthread_attr_getscope subroutine is unsuccessful if the following
is true:

EINVAL	The attr parameter is not valid.

ENOSYS	The priority scheduling POSIX option is not implemented.

Implementation Specifics

This subroutine is part of the Base Operating System (BOS) Runtime.

The implementation of this subroutine is dependent on the priority
scheduling POSIX option. The priority scheduling POSIX option is implemented
in AIX, but in the current version all threads have system contention
scope; therefore, the pthread_attr_getscope subroutine always returns
a scope value of PTHREAD_SCOPE_SYSTEM.

Related Information

The pthread_attr_setscope subroutine, pthread_attr_init subroutine.

Threads Scheduling.

Threads Library Options and Threads Library Quick Reference.