Everything

chg_pri

ichg_pri

Outline
Change task priority.
C format
 ER      chg_pri (ID tskid, PRI tskpri);
 ER      ichg_pri (ID tskid, PRI tskpri);
Parameter(s)
I/O
Parameter
Description
I
 ID      tskid;
ID number of the task whose priority is to be changed.
TSK_SELF: Invoking task.
Value: ID number of the task whose priority is to be changed.
I
 PRI     tskpri;
New base priority of the task.
TPRI_INI: Initial priority.
Value: New base priority.

Explanation
These service calls change the priority of the task specified by parameter tskid (current priority) to a value specified by parameter tskpri.
If the target task is in the RUNNING or READY state after this service call is issued, this service call re-queues the task at the end of the ready queue corresponding to the priority specified by parameter tskpri, following priority change processing.
Note When the target task is queued to a wait queue in the order of priority, the wait order may change due to issue of this service call.
Example When three tasks (task A: priority level 10, task B: priority level 11, task C: priority level 12) are queued to the semaphore wait queue in the order of priority, and the priority level of task B is changed from 11 to 9, the wait order will be changed as follows.
Return value
Macro
Value
Description
E_OK
0
Normal completion.
E_PAR
-17
Parameter error.
- tskpri < 0x0
- tskpri > Maximum priority
E_ID
-18
Invalid ID number.
- tskid < 0x0
- tskid > Maximum ID number
- When this service call was issued from a non-task, TSK_SELF was specified tskid.
E_CTX
-25
Context error.
- This service call was issued int the CPU locked state.
E_OBJ
-41
Object state error.
- Specified task is in the DORMANT state.
E_NOEXS
-42
Non-existent object.
- Specified task is not registered.