[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]


cma_thread_set_priority

Changes the current priority of a thread.

Syntax

cma_thread_set_priority(
                         thread,
                         priority);
 


Argument Data Type Access

thread opaque cma_t_thread read priority opaque cma_t_priority read


C Binding

#include 

void cma_thread_set_priority ( cma_t_thread *thread, cma_t_priority priority);

Arguments

thread
Handle of the thread whose priority is changed.
priority
New value of the priority attribute. The priority attribute is dependent upon scheduling policy. Valid values are as follows:
Low               Mid               High

cma_c_prio_fifo_ cma_c_prio_fifo_ cma_c_prio_fifo_max min mid cma_c_prio_rr_ cma_c_prio_rr_ cma_c_prio_rr_max min mid cma_c_prio_ cma_c_prio_ cma_c_prio_through_max through_min through_mid cma_c_prio_back_ cma_c_prio_back_ cma_c_prio_back_max min mid


The default priority is cma_c_prio_default_mid. (This symbol maps to cma_c_prio_through_mid.)

Description

This routine changes the current priority of a thread. A thread can change its own priority.

Changing the priority of a thread can cause it to start executing or to be preempted by another thread. The exact effect of setting different priority values depends on the scheduling priority assigned to the thread. The scheduling priority is set by calling the cma_attr_set_priority routine.

An application should specify priority only to express the urgency of executing the thread relative to other threads. Priority should not be used to control mutual exclusion when accessing shared data. With a sufficient number of processors executing, all ready threads, regardless of priority, can be executing simultaneously.

This routine is different from cma_attr_set_priority in that cma_ attr_set_ priority sets the priority attribute that is used to establish the priority of a new thread when it is created. However, this routine changes the priority of an existing thread.

Exceptions

cma_e_badparam
cma_e_existence
cma_e_unimp
cma_e_use_error
exc_e_nopriv



[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]