protected type defining_identifier [known_discriminant_part] is protected_definition;
protected defining_identifier is protected_definition;
{ protected_operation_declaration }
[ private
{ protected_element_declaration } ]
end [protected_identifier]
| entry_declaration
| representation_clause
| component_declaration
| subprogram_body
| entry_body
| representation_clause
task T is
entry E;
end T;
protected PO is
entry Ee;
end PO;
entry Ee when False is
begin
null;
end Ee;
end PO;
begin
accept E do
requeue PO.Ee;
end E;
end T;
begin
T.E;
end Main;
entry Seize;
procedure Release;
private
Busy : Boolean := False;
end Resource;
entry Seize when not Busy is
begin
Busy := True;
end Seize;
begin
Busy := False;
end Release;
end Resource;
-- Index, Item, and Item_Array are global types
function Component (N : in Index) return Item;
procedure Set_Component(N : in Index; E : in Item);
private
Table : Item_Array(Index) := (others => Null_Item);
end Shared_Array;
function Component(N : in Index) return Item is
begin
return Table(N);
end Component;
begin
Table(N) := E;
end Set_Component;
end Shared_Array;
Flags : array(1 .. 100) of Resource;