In Solaris threads, a thread created with a priority other than the priority of its parents is created in SUSPEND mode. While suspended, the thread's priority is modified using the thr_setprio(3C) function call. After thr_setprio() completes, the thread resumes execution.
A higher priority thread receives precedence over lower priority threads with respect to synchronization object contention.
#include <thread.h> int thr_setprio(thread_t tid, int newprio)
thread_t tid; int ret; int newprio = 20; /* suspended thread creation */ ret = thr_create(NULL, NULL, func, arg, THR_SUSPENDED, &tid); /* set the new priority of suspended child thread */ ret = thr_setprio(tid, newprio); /* suspended child thread starts executing with new priority */ ret = thr_continue(tid);
The value specified by tid does not refer to an existing thread.
The value of priority is invalid for the scheduling policy of the specified thread.
The caller does not have the appropriate permission to set the priority to the value specified.