OSA : OS_Task_SetPriority

OS_Task_SetPriority (OST_TASK_POINTER tp, char priority)

Set priority of task.

Before calling this service you should be sure that variable tp was initialized.

The macro this_task or the service OS_Task_GetCur() can be used to perform this operation on current task.

Call allowed:

Only in task

Parameters:

tp Pointer to task descriptor (OST_TASK_POINTER)
priority Task priority. Allowed values from 0 (highest) to 7 (lowest)

Returns:

nothing

Example:

void Task (void)
{
    for (;;) {
        /*...*/
        OS_Task_SetPriority(this_task, 0);    // Set highest priority
        /* Do time critical operations */
        /*...*/
        OS_Task_SetPriority(this_task, 7);    // Set lowest priority
        /*...*/
    }
}

Old style name

OS_SetTaskPriority

See also