RTEMS Logo

RTEMS 4.10.2 On-Line Library


Task Manager TASK_MODE - Change the current task mode

PREV UP NEXT Bookshelf RTEMS C User's Guide

5.4.11: TASK_MODE - Change the current task mode

CALLING SEQUENCE:

rtems_status_code rtems_task_mode(
  rtems_mode  mode_set,
  rtems_mode  mask,
  rtems_mode *previous_mode_set
);

DIRECTIVE STATUS CODES:

RTEMS_SUCCESSFUL - task mode set successfully
RTEMS_INVALID_ADDRESS - previous_mode_set is NULL

DESCRIPTION:

This directive manipulates the execution mode of the calling task. A task's execution mode enables and disables preemption, timeslicing, asynchronous signal processing, as well as specifying the current interrupt level. To modify an execution mode, the mode class(es) to be changed must be specified in the mask parameter and the desired mode(s) must be specified in the mode parameter.

NOTES:

The calling task will be preempted if it enables preemption and a higher priority task is ready to run.

Enabling timeslicing has no effect if preemption is disabled. For a task to be timesliced, that task must have both preemption and timeslicing enabled.

A task can obtain its current execution mode, without modifying it, by calling this directive with a mask value of RTEMS_CURRENT_MODE.

To temporarily disable the processing of a valid ASR, a task should call this directive with the RTEMS_NO_ASR indicator specified in mode.

The set of task mode constants and each mode's corresponding mask constant is provided in the following table:

Mode Constant Mask Constant Description
RTEMS_PREEMPT RTEMS_PREEMPT_MASK enables preemption
RTEMS_NO_PREEMPT RTEMS_PREEMPT_MASK disables preemption
RTEMS_NO_TIMESLICE RTEMS_TIMESLICE_MASK disables timeslicing
RTEMS_TIMESLICE RTEMS_TIMESLICE_MASK enables timeslicing
RTEMS_ASR RTEMS_ASR_MASK enables ASR processing
RTEMS_NO_ASR RTEMS_ASR_MASK disables ASR processing
RTEMS_INTERRUPT_LEVEL(0) RTEMS_INTERRUPT_MASK enables all interrupts
RTEMS_INTERRUPT_LEVEL(n) RTEMS_INTERRUPT_MASK sets interrupts level n


PREV UP NEXT Bookshelf RTEMS C User's Guide

Copyright © 1988-2008 OAR Corporation