Ada Reference ManualLegal Information
Contents   Index   References   Search   Previous   Next 

9.5.4 Requeue Statements

1
A requeue_statement can be used to complete an accept_statement or entry_body, while redirecting the corresponding entry call to a new (or the same) entry queue. Such a requeue can be performed with or without allowing an intermediate cancellation of the call, due to an abort or the expiration of a delay.

Syntax

2
requeue_statement ::= requeue entry_name [with abort];

Name Resolution Rules

3
The entry_name of a requeue_statement shall resolve to denote an entry (the target entry) that either has no parameters, or that has a profile that is type conformant (see 6.3.1) with the profile of the innermost enclosing entry_body or accept_statement.

Legality Rules

4
A requeue_statement shall be within a callable construct that is either an entry_body or an accept_statement, and this construct shall be the innermost enclosing body or callable construct.
5
If the target entry has parameters, then its profile shall be subtype conformant with the profile of the innermost enclosing callable construct.
6
In a requeue_statement of an accept_statement of some task unit, either the target object shall be a part of a formal parameter of the accept_statement, or the accessibility level of the target object shall not be equal to or statically deeper than any enclosing accept_statement of the task unit. In a requeue_statement of an entry_body of some protected unit, either the target object shall be a part of a formal parameter of the entry_body, or the accessibility level of the target object shall not be statically deeper than that of the entry_declaration.

Dynamic Semantics

7
The execution of a requeue_statement proceeds by first evaluating the entry_name, including the prefix identifying the target task or protected object and the expression identifying the entry within an entry family, if any. The entry_body or accept_statement enclosing the requeue_statement is then completed, finalized, and left (see 7.6.1).
8
For the execution of a requeue on an entry of a target task, after leaving the enclosing callable construct, the named entry is checked to see if it is open and the requeued call is either selected immediately or queued, as for a normal entry call (see 9.5.3).
9
For the execution of a requeue on an entry of a target protected object, after leaving the enclosing callable construct: 
10
if the requeue is an internal requeue (that is, the requeue is back on an entry of the same protected object — see 9.5), the call is added to the queue of the named entry and the ongoing protected action continues (see 9.5.1);
11
if the requeue is an external requeue (that is, the target protected object is not implicitly the same as the current object — see 9.5), a protected action is started on the target object and proceeds as for a normal entry call (see 9.5.3). 
12
If the new entry named in the requeue_statement has formal parameters, then during the execution of the accept_statement or entry_body corresponding to the new entry, the formal parameters denote the same objects as did the corresponding formal parameters of the callable construct completed by the requeue. In any case, no parameters are specified in a requeue_statement; any parameter passing is implicit.
13
If the requeue_statement includes the reserved words with abort (it is a requeue-with-abort), then: 
14
if the original entry call has been aborted (see 9.8), then the requeue acts as an abort completion point for the call, and the call is cancelled and no requeue is performed;
15
if the original entry call was timed (or conditional), then the original expiration time is the expiration time for the requeued call. 
16
If the reserved words with abort do not appear, then the call remains protected against cancellation while queued as the result of the requeue_statement.
NOTES
17
31  A requeue is permitted from a single entry to an entry of an entry family, or vice-versa. The entry index, if any, plays no part in the subtype conformance check between the profiles of the two entries; an entry index is part of the entry_name for an entry of a family.

Examples

18
Examples of requeue statements: 
19
requeue Request(Medium) with abort;
                    -- requeue on a member of an entry family of the current task, see 9.1
20
requeue Flags(I).Seize;
                    -- requeue on an entry of an array component, see 9.4

Contents   Index   References   Search   Previous   Next 
Ada-Europe Sponsored by Ada-Europe