9.5 Intertask Communication
The primary 
means for intertask communication is provided by calls on entries and 
protected subprograms. Calls on protected subprograms allow coordinated 
access to shared data objects. Entry calls allow for blocking the caller 
until a given condition is satisfied (namely, that the corresponding 
entry is open — see 
9.5.3), and then 
communicating data or control information directly with another task 
or indirectly via a shared protected object.
 
Static Semantics
When 
a 
name or 
prefix denotes 
an entry, protected subprogram, or a prefixed view of a primitive subprogram 
of a limited interface whose first parameter is a controlling parameter, 
the 
name or 
prefix determines 
a 
target object, as follows: 
 
If it is a 
direct_name 
or expanded name that denotes the declaration (or body) of the operation, 
then the target object is implicitly specified to be the current instance 
of the task or protected unit immediately enclosing the operation; 
a 
call using such a name is defined to be an 
internal call;
 
If it is a 
selected_component 
that is not an expanded name, then the target object is explicitly specified 
to be the  object denoted by the 
prefix 
of the 
name; 
a call using such a name is defined to be an 
external 
call; 
 
If the 
name 
or 
prefix 
is a dereference (implicit or explicit) of an access-to-protected-subprogram 
value, then the target object is determined by the 
prefix 
of the Access 
attribute_reference 
that produced the access value originally; a call using such a name is 
defined to be an 
external call;
 
  A call on an entry or a protected subprogram either 
uses a 
name 
or 
prefix 
that determines a target object implicitly, as above, or is a call on 
(a non-prefixed view of) a primitive subprogram of a limited interface 
whose first parameter is a controlling parameter, in which case the target 
object is identified explicitly by the first parameter. This latter case 
is an 
external call.
 
A 
corresponding definition of target object applies to a 
requeue_statement 
(see 
9.5.4), with a corresponding distinction 
between an 
internal requeue and an 
external requeue.
 
Legality Rules
  If a 
name 
or 
prefix 
determines a target object, and the name denotes a protected entry or 
procedure, then the target object shall be a variable, unless the 
prefix 
is for an 
attribute_reference 
to the Count attribute (see 
9.9). 
 
Dynamic Semantics
Within the body of a protected operation, the current 
instance (see 
8.6) of the immediately enclosing 
protected unit is determined by the target object specified (implicitly 
or explicitly) in the call (or requeue) on the protected operation. 
 
Any call on a protected procedure or entry of a target 
protected object is defined to be an update to the object, as is a requeue 
on such an entry. 
Syntax
synchronization_kind ::= By_Entry | By_Protected_Procedure | Optional
 
Static Semantics
 For the declaration 
of a primitive procedure of a synchronized tagged type the following 
language-defined representation aspect may be specified with an 
aspect_specification 
(see 
13.1.1):
 
 Synchronization
If specified, the aspect definition shall be a 
synchronization_kind.
 
 Inherited subprograms inherit the Synchronization 
aspect, if any, from the corresponding subprogram of the parent or progenitor 
type. If an overriding operation does not have a directly specified Synchronization 
aspect then the Synchronization aspect of the inherited operation is 
inherited by the overriding operation. 
Legality Rules
 The 
synchronization_kind 
By_Protected_Procedure shall not be applied to a primitive procedure 
of a task interface.
 
 A procedure for which the specified 
synchronization_kind 
is By_Entry shall be implemented by an entry. A procedure for which the 
specified 
synchronization_kind 
is By_Protected_Procedure shall be implemented by a protected procedure. 
A procedure for which the specified 
synchronization_kind 
is Optional may be implemented by an entry or by a procedure (including 
a protected procedure).
 
 If a primitive procedure overrides an inherited 
operation for which the Synchronization aspect has been specified to 
be By_Entry or By_Protected_Procedure, then any specification of the 
aspect Synchronization applied to the overriding operation shall have 
the same 
synchronization_kind.
 
 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. 
 
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe