D.11 Asynchronous Task Control
This Reference Manual output has not been verified, and may contain omissions or errors. Report any problems on the tracking issue
[This subclause introduces a language-defined package to do asynchronous suspend/resume on tasks. It uses a conceptual held priority value to represent the task's held state.]
Static Semantics
2The following language-defined library package exists:
with Ada.Task_Identification;
package Ada.Asynchronous_Task_Control
with Preelaborate, Nonblocking, Global => in out synchronized is
procedure Hold(T : in Ada.Task_Identification.Task_Id);
procedure Continue(T : in Ada.Task_Identification.Task_Id);
function Is_Held(T : Ada.Task_Identification.Task_Id)
return Boolean;
end Ada.Asynchronous_Task_Control;
Dynamic Semantics
4/2After the Hold operation has been applied to a task, the task becomes held. For each processor there is a conceptual idle task, which is always ready. The base priority of the idle task is below System.Any_Priority'First. The held priority is a constant of the type Integer whose value is below the base priority of the idle task.
For any priority below System.Any_Priority'First, the task dispatching policy is FIFO_Within_Priorities.
The Hold operation sets the state of T to held. For a held task, the active priority is reevaluated as if the base priority of the task were the held priority.
The Continue operation resets the state of T to not-held; its active priority is then reevaluated as determined by the task dispatching policy associated with its base priority.
The Is_Held function returns True if and only if T is in the held state.
As part of these operations, a check is made that the task identified by T is not terminated. Tasking_Error is raised if the check fails. Program_Error is raised if the value of T is Null_Task_Id.
Erroneous Execution
9If any operation in this package is called with a parameter T that specifies a task object that no longer exists, the execution of the program is erroneous.
Implementation Permissions
10/5An implementation may omit support for Asynchronous_Task_Control if it is infeasible to support it in the target environment.
- When a held task is on the ready queue, its priority is so low as to never reach the top of the queue as long as there are other tasks on that queue.
- If a task is executing in a protected action, inside a rendezvous, or is inheriting priorities from other sources (e.g. when activated), it continues to execute until it is no longer executing the corresponding construct.
- If a task becomes held while waiting (as a caller) for a rendezvous to complete, the active priority of the accepting task is not affected.
- {8652/0077} If a task becomes held while waiting in a
selective_accept
, and an entry call is issued to one of the open entries, the correspondingaccept_alternative
executes. When the rendezvous completes, the active priority of the accepting task is lowered to the held priority (unless it is still inheriting from other sources), and the task does not execute until another Continue. 19 - The same holds if the held task is the only task on a protected entry queue whose barrier becomes open. The corresponding entry body executes.