pthread_attr_setschedpolicy()

QNX SDP8.0C Library ReferenceAPIDeveloper

Set the thread scheduling policy attribute

Synopsis:

#include <pthread.h>
#include <sched.h>

int pthread_attr_setschedpolicy(
                 pthread_attr_t* attr,
                 int policy );

Arguments:

attr
A pointer to the pthread_attr_t structure that defines the attributes to use when creating new threads. For more information, see pthread_attr_init().
policy
The new value for the scheduling policy:
  • SCHED_FIFO — first-in first-out scheduling.
  • SCHED_RR — round-robin scheduling.
  • SCHED_OTHER — currently the same as SCHED_RR.
  • SCHED_NOCHANGE — don't change the policy.
  • SCHED_SPORADIC — sporadic scheduling. For more information, see pthread_attr_setschedpolicy(), and Scheduling policies in the chapter on the microkernel in the System Architecture guide.
  • SCHED_HIGH_PRIORITY_IST — a FIFO scheduling policy that allows a thread to go at or above the clock IST, but below 255.
    Note:
    The SCHED_HIGH_PRIORITY_IST policy is intended only for ISTs. For more information, see Interrupt Service Thread (IST) in the Programmer's Guide.
  • SCHED_OFFLINING — a FIFO scheduling policy intended for CPU offlining that allows a thread to be of higher priority than the clock IST.
    Note:
    • To set the SCHED_OFFLINING policy, the process must have the runstate ability enabled. For more information, go to Abilities in the QNX OS System Security Guide.
    • The offlining and onlining scheduling feature is experimental.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The pthread_attr_setschedpolicy() function sets the thread scheduling policy attribute in the thread attribute object attr to policy.

The policy attribute is used only if you've set the thread inherit-scheduling attribute to PTHREAD_EXPLICIT_SCHED by calling pthread_attr_setinheritsched().

For descriptions of the scheduling policies, see Scheduling policies in the chapter on the microkernel in the System Architecture guide.

Returns:

EOK
Success.
EINVAL
Invalid thread-scheduling policy policy.

Classification:

POSIX 1003.1 TPS

Safety:
Cancellation pointNo
Signal handlerYes
ThreadYes
Page updated: