9.5.2 Entries and Accept Statements
Syntax
Name Resolution Rules
Legality Rules
An
entry_declaration
in a task declaration shall not contain a specification for an access
parameter (see
3.10).
if the
overriding_indicator
is
not overriding, then the entry shall not implement any inherited
subprogram.
In addition to the places
where Legality Rules normally apply (see
12.3),
these rules also apply in the private part of an instance of a generic
unit.
Static Semantics
In the
entry_body
for an entry family, the
entry_index_specification
declares a named constant whose subtype is the entry index subtype defined
by the corresponding
entry_declaration;
the value of the
named entry index identifies
which entry of the family was called.
Dynamic Semantics
The actions to be performed when an entry is called
are specified by the corresponding
accept_statements
(if any) for an entry of a task unit, and by the corresponding
entry_body
for an entry of a protected unit.
The above interaction between
a calling task and an accepting task is called a
rendezvous. After
a rendezvous, the two tasks continue their execution independently.
24 A task entry has corresponding accept_statements
(zero or more), whereas a protected entry has a corresponding entry_body
(exactly one).
27 The
condition
in the
entry_barrier
may reference anything visible except the formal parameters of the entry.
This includes the entry index (if any), the components (including discriminants)
of the protected object, the Count attribute of an entry of that protected
object, and data global to the protected unit.
The restriction against referencing the formal parameters
within an
entry_barrier
ensures that all calls of the same entry see the same barrier value.
If it is necessary to look at the parameters of an entry call before
deciding whether to handle it, the
entry_barrier
can be “
when True” and the caller can be requeued
(on some private entry) when its parameters indicate that it cannot be
handled immediately.
Examples
Examples of entry
declarations:
entry Read(V : out Item);
entry Seize;
entry Request(Level)(D : Item); -- a family of entries
Examples of accept
statements:
accept Shut_Down;
accept Read(V : out Item) do
V := Local_Item;
end Read;
accept Request(Low)(D : Item) do
...
end Request;
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe