D.2.4 Non-Preemptive Dispatching
This subclause defines a non-preemptive task dispatching
policy.
Static Semantics
The
policy_identifier
Non_Preemptive_FIFO_Within_Priorities is a task dispatching policy.
The following language-defined
library package exists:
package Ada.Dispatching.Non_Preemptive
with Preelaborate, Nonblocking, Global =>
in out synchronized is
procedure Yield_To_Higher;
procedure Yield_To_Same_Or_Higher
renames Yield;
end Ada.Dispatching.Non_Preemptive;
A call of Yield_To_Higher is a task dispatching
point for this policy. If the task at the head of the highest priority
ready queue has a higher active priority than the calling task, then
the calling task is preempted.
Legality Rules
Non_Preemptive_FIFO_Within_Priorities shall not be
specified as the
policy_identifier
of
pragma
Priority_Specific_Dispatching (see
D.2.2).
Dynamic Semantics
When Non_Preemptive_FIFO_Within_Priorities is in
effect, modifications to the ready queues occur only as follows:
When a blocked task becomes ready, it is added
at the tail of the ready queue for its active priority.
When the active priority of a ready task that is
not running changes, or the setting of its base priority takes effect,
the task is removed from the ready queue for its old active priority
and is added at the tail of the ready queue for its new active priority.
When the setting of the base priority of a running
task takes effect, the task is added to the tail of the ready queue for
its active priority.
When a task executes a
delay_statement
that does not result in blocking, it is added to the tail of the ready
queue for its active priority.
For this policy, blocking or termination of a task,
a
delay_statement,
a call to Yield_To_Higher, and a call to Yield_To_Same_Or_Higher or Yield
are the only task dispatching points (see
D.2.1).
Implementation Requirements
An implementation shall allow, for a single partition,
both the task dispatching policy to be specified as Non_Preemptive_FIFO_Within_Priorities
and also the locking policy (see
D.3) to be
specified as Ceiling_Locking.
Implementation Permissions
Since implementations are allowed to round up to
System.Priority'Last all ceiling priorities in subrange System.Priority'Range
(see
D.3), an implementation may allow a task
of a partition using the Non_Premptive_FIFO_Within_Priorities policy
to execute within a protected object without raising its active priority
provided the associated protected unit does not contain any subprograms
with aspects Interrupt_Handler or Attach_Handler specified, nor does
the unit have aspect Interrupt_Priority specified. When the locking policy
(see
D.3) is Ceiling_Locking, an implementation
taking advantage of this permission shall ensure that a call to Yield_to_Higher
that occurs within a protected action uses the ceiling priority of the
protected object (rather than the active priority of the task) when determining
whether to preempt the task.
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe