Multithreaded Programming Guide

Exit Print View

Updated: July 2014
 
 

Setting the Thread Priority

pthread_setschedprio(3C) sets the scheduling priority for the specified thread.

pthread_setschedprio Syntax

int pthread_setschedprio(pthread_t tid, int prio);
#include <pthread.h>

pthread_t tid;
int prio;
int ret;

pthread_setschedprio Return Values

pthread_setschedprio() returns zero after completing successfully. Any other return value indicates that an error occurred. When the following condition occurs, the function fails and returns the corresponding value.

EINVAL

Description: The value of prio is invalid for the scheduling policy of the specified thread.

ENOTSUP

Description: An attempt was made to set the priority to an unsupported value.

EPERM

Description: The caller does not have the appropriate permission to set the scheduling priority of the specified thread.

ESRCH

Description: The value specified by tid does not refer to an existing thread.