pthread_setschedprio()

Set a thread's priority

Synopsis:

#include <pthread.h>

int pthread_setschedprio( pthread_t thread,
                          int prio );

Arguments:

thread
The ID of the thread that you want to get the scheduling parameters for. You can get a thread ID by calling pthread_create() or pthread_self().
prio
The new scheduling priority.

Library:

libc

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

Description:

The pthread_setschedprio() function sets the priority of thread thread to prio.

If the thread is running or runnable, the effect on its position in the ready queue depends on the direction of the modification:

The pthread_setschedprio() function gives you a way to temporarily raise a thread's priority and lower it again, without yielding to other threads of the same priority. This is necessary if you have to implement your own strategies for bounding priority inversion, such as priority inheritance or priority ceilings.

Returns:

EOK
Success.
EINVAL
The priority isn't valid for the scheduling policy of the specified thread.
ENOTSUP
The specified priority isn't supported.
EPERM
The calling thread doesn't have sufficient privileges to modify the specified thread's priority.
ESRCH
Invalid thread ID thread.

Classification:

POSIX 1003.1 THR TPS

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

pthread_getschedparam(), pthread_setschedparam(), sched_setparam()

Thread scheduling in the QNX Neutrino Microkernel chapter of the System Architecture guide

Scheduling policies in the Programming Overview chapter of the QNX Neutrino Programmer's Guide