pthread_attr_getsrad_np and pthread_attr_setsrad_np Subroutines

Purpose

Gets and sets the SRAD (Scheduler Resource Allocation Domain) affinity attribute of a thread attributes object.

Library

Threads Library (libpthreads.a)

Syntax

#include <pthread.h>

int pthread_attr_setsrad_np (attr, srad,flags)
pthread_attr_tattr;
sradid_tsrad;
int flags;
int pthread_attr_getsrad_np (attr, srad,flagsp)
pthread_attr_t *attr;
sradid_t *srad;
int *flagsp;

Description

The sradp/srad parameter specifies the SRAD that attracts a thread created with the attributes object. By default, newly created threads are balanced over the SRADs in a system in accordance with system policies.

The pthread_attr_getsrad_np subroutine gets the SRAD affinity attribute, while the pthread_attr_setsrad_np subroutine sets the SRAD affinity attribute in the thread attributes object specified by the attr parameter.

The flags parameter indicates whether the SRAD attachment is strict or advisory.

The flagsp parameter returns R_STRICT_SRAD if the SRAD attachment, if any, is strict.

Parameters

Item Description
attr Specifies the thread attributes object.
sradp Points to a location where the SRAD to be extracted is stored.
srad Specifies the SRAD to be extracted.
flags

Setting R_STRICT_SRAD indicates that the SRAD is a strictly preferred one.

If SRAD attachment is NULL, set to R_STRICT_SRAD.

flagsp Points to a location where the flags associated with the SRAD attachment, if any, is stored.

Return Values

Upon successful completion, the pthread_attr_getsrad_np and pthread_attr_setsrad_np subroutines return a value of 0. Otherwise, an error number is returned to indicate the error.

Error Codes

The pthread_attr_getsrad_np and pthread_attr_setsrad_np subroutines are unsuccessful if the following are true:

Item Description
ENOTSUP Enhanced affinity is not present or not enabled.
EINVAL (pthread_attr_getsrad_np) The attribute object specified by the attr parameter is invalid or the address pointed by the sradp parameter is not aligned to hold an sradid_t.
EINVAL (pthread_attr_setsrad_np) The SRAD affinity value specified by the sradp parameter is not valid.
Note: The pthread_attr_getsrad_np, and pthread_attr_setsrad_np functions do not return the error code EINTR.