9.8 Abort of a Task - Abort of a Sequence of Statements
This Reference Manual output has not been verified, and may contain omissions or errors. Report any problems on the tracking issue
abort_statement causes one or more tasks to become abnormal, thus preventing any further interaction with such tasks. The completion of the
triggering_statement of an
asynchronous_select causes a
sequence_of_statements to be aborted.]
Name Resolution Rules3/5
name is expected to be of any task type[; each can be of a different task type.]
For the execution of an
abort_statement, the given task_
names are evaluated in an arbitrary order. Each named task is then aborted, which consists of making the task abnormal and aborting the execution of the corresponding
task_body, unless it is already completed.
abort_statement, or if the task executing the
abort_statementdepends on one of the named tasks, then it is possible for the execution of the
abort_statementto be aborted, thus leaving some of the tasks unaborted. This allows the implementation to use either a sequence of calls to an “abort task” run-time system primitive, or a single call to an “abort list of tasks” run-time system primitive.
When the execution of a construct is aborted (including that of a
task_body or of a
sequence_of_statements), the execution of every construct included within the aborted execution is also aborted, except for executions included within the execution of an abort-deferred operation; the execution of an abort-deferred operation continues to completion without being affected by the abort; the following are the abort-deferred operations:
- a protected action;
- waiting for an entry call to complete (after having initiated the attempt to cancel it — see below);
- waiting for the termination of dependent tasks;
- the execution of an Initialize procedure as the last step of the default initialization of a controlled object;
- the execution of a Finalize procedure as part of the finalization of a controlled object;
- an assignment operation to an object with a controlled part.
[The last three of these are discussed further in 7.6.]
assignment_statement". Explicit calls to Initialize, Finalize, or Adjust are not abort-deferred.
When a master is aborted, all tasks that depend on that master are aborted.
The order in which tasks become abnormal as the result of an
abort_statement or the abort of a
sequence_of_statements is not specified by the language.
If the execution of an entry call is aborted, an immediate attempt is made to cancel the entry call (see 9.5.3). If the execution of a construct is aborted at a time when the execution is blocked, other than for an entry call, at a point that is outside the execution of an abort-deferred operation, then the execution of the construct completes immediately. For an abort due to an
abort_statement, these immediate effects occur before the execution of the
abort_statement completes. Other than for these immediate cases, the execution of a construct that is aborted does not necessarily complete before the
abort_statement completes. However, the execution of the aborted construct completes no later than its next abort completion point (if any) that occurs outside of an abort-deferred operation; the following are abort completion points for an execution:
- the point where the execution initiates the activation of another task;
- the end of the activation of a task;
- a point within a parallel construct where a new logical thread of control is created;
- the end of a parallel construct;
- the start or end of the execution of an entry call,
delay_statement, these operations might be cut short because an abort attempts to cancel them.
- the start of the execution of a
select_statement, or of the
exception_handleris considered an abort completion point simply because it is easy for an implementation to check at such points.
Bounded (Run-Time) Errors20/5
An attempt to execute an
asynchronous_select as part of the execution of an abort-deferred operation is a bounded error. Similarly, an attempt to create a task that depends on a master that is included entirely within the execution of an abort-deferred operation is a bounded error. In both cases, Program_Error is raised if the error is detected by the implementation; otherwise, the operations proceed as they would outside an abort-deferred operation, except that an abort of the
abortable_part or the created task does not necessarily have an effect.
asynchronous_selectrelies on an abort of the
abortable_partto effect the asynchronous transfer of control. For an
asynchronous_selectwithin an abort-deferred operation, the abort might have no effect.
If an assignment operation completes prematurely due to an abort, the assignment is said to be disrupted; the target of the assignment or its parts can become abnormal, and certain subsequent uses of the object can be erroneous, as explained in 13.9.1.
abort_statementis best used only in situations requiring unconditional termination.