PxTaskSetPrio()

Set task priority.

APPLIES TO

8.2.0

SYNOPSIS
PxError_t PxTaskSetPrio (PxTask_t taskid, PxPrio_t prio);
ARGUMENTS
taskid

Task whose priority is changed

prio

The new priority of the task

RETURN VALUES
  • PXROS error code

ERROR CODES

PXERR_ACCESS_RIGHT

The calling task does not have the right to change the prio of the task

PXERR_GLOBAL_ILLEGAL_CORE

The requested task is not on the same core

PXERR_TASK_ILLPRIO

prio is not a valid PXROS priority

PXERR_TASK_ILLTASK

taskid is not a valid task object

DESCRIPTION

This service gives task the priority prio. If task is the calling tasks identifier and prio its current priority, the calling task is placed at the end of the appropriate ready list (i.e., scheduling is enforced).

IMPLEMENTATION GUIDELINES
Before call
  • The parameter taskid must be a valid task object id. This id may be

    • the calling task’s own id read by calling PxGetId() (V)

    • the return value of a PxTaskCreate() call (V)

    • the result of a nameserver query (V)

    • part of a message sent by another task (V)

  • The task object must be created on the same core as the caller runs on. The creator core id can be read with the macro PxTaskCoreId and the own core id with PxGetCoreId (C).Additionally the task id may be checked with PxTaskCheck() (F).

  • prio should be a plausible priority value (typically between 0 and 31) (V)

After call
  • The function returns PXERR_NOERROR if the task’s priority could be changed. Any other return value describes an error, which has to be interpreted (C).

Best Practice
  • No restrictions.

SEE ALSO
USAGE
#include "pxdef.h"

PxError_t err = PxTaskSetPrio(taskid, 10);

if (err != PXERR_NOERROR) {
    // Report error
}