Annotated Ada Reference ManualLegal Information
Table of Contents   Index   References   Search   Previous   Next 

 9.7.2 Timed Entry Calls

1/2
{AI95-00345-01} [A timed_entry_call issues an entry call that is cancelled if the call (or a requeue-with-abort of the call) is not selected before the expiration time is reached. A procedure call may appear rather than an entry call for cases where the procedure might be implemented by an entry. {time-out: See timed_entry_call} ]

Syntax

2
timed_entry_call ::= 
  select
   entry_call_alternative
  or
   delay_alternative
  end select;
3/2
{AI95-00345-01} entry_call_alternative ::= 
  procedure_or_entry_call entry_call_statement [sequence_of_statements]
3.1/2
{AI95-00345-01} procedure_or_entry_call ::= 
  procedure_call_statement | entry_call_statement

Legality Rules

3.2/2
  {AI95-00345-01} If a procedure_call_statement is used for a procedure_or_entry_call, the procedure_name or procedure_prefix of the procedure_call_statement shall statically denote an entry renamed as a procedure or (a view of) a primitive subprogram of a limited interface whose first parameter is a controlling parameter (see 3.9.2). 
3.a/2
Reason: This would be a confusing way to call a procedure, so we only allow it when it is possible that the procedure is actually an entry. We could have allowed formal subprograms here, but we didn't because we'd have to allow all formal subprograms, and it would increase the difficulty of generic code sharing.
3.b/2
We say “statically denotes” because an access-to-subprogram cannot be primitive, and we don't have anything like access-to-entry. So only names of entries or procedures are possible. 

Static Semantics

3.3/2
  {AI95-00345-01} If a procedure_call_statement is used for a procedure_or_entry_call, and the procedure is implemented by an entry, then the procedure_name, or procedure_prefix and possibly the first parameter of the procedure_call_statement, determine the target object of the call and the entry to be called.
3.c/2
Discussion: The above says “possibly the first parameter”, because Ada allows entries to be renamed and passed as formal subprograms. In those cases, the task or protected object is implicit in the name of the routine; otherwise the object is an explicit parameter to the call. 

Dynamic Semantics

4/2
{AI95-00345-01} {execution (timed_entry_call) [partial]} For the execution of a timed_entry_call, the entry_name, procedure_name, or procedure_prefix, and any actual parameters are evaluated, as for a simple entry call (see 9.5.3) or procedure call (see 6.4). The expiration time (see 9.6) for the call is determined by evaluating the delay_expression of the delay_alternative. If the call is an entry call or a call on a procedure implemented by an entry,; the entry call is then issued. Otherwise, the call proceeds as described in 6.4 for a procedure call, followed by the sequence_of_statements of the entry_call_alternative; the sequence_of_statements of the delay_alternative is ignored.
5
If the call is queued (including due to a requeue-with-abort), and not selected before the expiration time is reached, an attempt to cancel the call is made. If the call completes due to the cancellation, the optional sequence_of_statements of the delay_alternative is executed; if the entry call completes normally, the optional sequence_of_statements of the entry_call_alternative is executed.
5.a/2
This paragraph was deleted.Ramification: {AI-00345-01} The fact that the syntax calls for an entry_call_statement means that this fact is used in overload resolution. For example, if there is a procedure X and an entry X (both with no parameters), then "select X; ..." is legal, because overload resolution knows that the entry is the one that was meant. 

Examples

6
Example of a timed entry call: 
7
select
   Controller.Request(Medium)(Some_Item);
or
   delay 45.0;
   --  controller too busy, try something else
end select;

Wording Changes from Ada 83

7.a
This clause comes before the one for Conditional Entry Calls, so we can define conditional entry calls in terms of timed entry calls. 

Incompatibilities With Ada 95

7.b/2
{AI95-00345-01} {incompatibilities with Ada 95} A procedure can be used as the in a timed or conditional entry call, if the procedure might actually be an entry. Since the fact that something is an entry could be used in resolving these calls in Ada 95, it is possible for timed or conditional entry calls that resolved in Ada 95 to be ambiguous in Ada 2005. That could happen if both an entry and procedure with the same name and profile exist, which should be rare. 

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