Changes the scheduling priority attribute of thread creation.
pthread_attr_setprio( attr, priority );
Argument Data Type Accessattr opaque pthread_attr_t read priority integer read
int pthread_attr_setprio ( pthread_attr_t *attr, int priority);
Low HighPRI_FIFO_MIN PRI_FIFO_MAX PRI_RR_MIN PRI_RR_MAX PRI_OTHER_MIN PRI_OTHER_MAX PRI_FG_MIN_NP PRI_FG_MAX_NP PRI_BG_MIN_NP PRI_BG_MAX_NP
The default priority is the midpoint between PRI_OTHER_MIN and PRI_ OTHER_MAX. (Section 2.7 describes how to specify priorities between the minimum and maximum values.)
By default, a created thread inherits the priority of the thread calling pthread_create. To specify a priority using this routine, scheduling inheritance must be disabled at the time the thread is created. Call pthread_attr_setinheritsched and specify the value PTHREAD_DEFAULT_SCHED for the inherit argument before calling pthread_create.
An application specifies priority only to express the urgency of executing the thread relative to other threads. Priority is not used to control mutual exclusion when accessing shared data. With a sufficient number of processors executing, all ready threads, regardless of priority, execute simultaneously.
Return Error Description0 Successful completion. -1 [EINVAL] The value specified by priority is invalid. -1 [ERANGE] One or more arguments supplied have an invalid value.