procedure Task_Mode ( Mode_Set : in RTEMS.Mode; Mask : in RTEMS.Mode; Previous_Mode_Set : in RTEMS.Mode; Result : out RTEMS.Status_Codes );
RTEMS.SUCCESSFUL
- task mode set successfully
RTEMS.INVALID_ADDRESS
- previous_mode_set
is NULL
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.
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 |
Copyright © 1988-2008 OAR Corporation