Open System Services System Calls Reference Manual (G06.25+, H06.03+)
pthread_attr_setschedparam(2) OSS System Calls Reference Manual
NAME
pthread_attr_setschedparam
- Sets the scheduling parameters of the scheduling policy attri-
bute of a thread attributes object
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
#include <spthread.h>
int pthread_attr_setschedparam(
pthread_attr_t *attr,
const struct sched_param *param );
PARAMETERS
attr specifies the address of the thread attributes object with the scheduling policy
attribute whose scheduling parameters are to be set.
param specifies a structure containing the new values for the scheduling parameters.
The system provides only the sched_priority scheduling parameter. See
Description for information about this scheduling parameter.
DESCRIPTION
This function sets the values of the scheduling parameters of the scheduling policy attribute of
the thread attributes object specified by the attr parameter to the values specified by the param
parameter.
Use the sched_priority field of the sched_param structure to set a thread’s execution priority.
The effect of the scheduling priority you assign depends on the scheduling policy attribute of the
thread attributes object specified by the attr parameter.
By default, the prioirty of a created thread is determined by the attr parameter used in the call to
the pthread_create() function. To inherit the prioirty of the thread calling pthread_create(),
scheduling inheritance must be enabled when the thread is created. Before calling
pthread_create(), call pthread_attr_setinheritsched() and specify the value
PTHREAD_INHERIT_SCHED for the inherit parameter.
An application specifies priority only to express the urgency of executing the thread relative to
other threads. DO NOT USE PRIORITY TO CONTROL MUTUAL EXCLUSION WHEN
ACCESSING SHARED DATA. With a sufficient number of processors present, all ready
threads, regardless of priority, execute simultaneously.
Valid values of the sched_priority scheduling parameter depend on the chosen scheduling pol-
icy. Use the sched_get_priority_min() and sched_get_priority_max() functions to determine
the low and high limits of each policy.
Open System Services provides the following nonportable priority range constants:
SCHED_FIFO
PRI_FIFO_MIN to PRI_FIFO_MAX
SCHED_RR PRI_RR_MIN to PRI_RR_MAX
SCHED_OTHER
PRI_OTHER_MIN to PRI_OTHER_MAX
5−34 Hewlett-Packard Company 527186-003