Ada Reference Manual (Ada 2022)Legal Information
Contents   Index   References   Search   Previous   Next 

D.4 Entry Queuing Policies

1/5
This subclause specifies a mechanism for a user to choose an entry queuing policy. It also defines three such policies. Other policies are implementation defined. 

Syntax

2
The form of a pragma Queuing_Policy is as follows: 
3
  pragma Queuing_Policy(policy_identifier);

Legality Rules

4/5
The policy_identifier shall be either FIFO_Queuing, Ordered_FIFO_Queuing, Priority_Queuing or an implementation-defined identifier.

Post-Compilation Rules

5
A Queuing_Policy pragma is a configuration pragma.

Dynamic Semantics

6
A queuing policy governs the order in which tasks are queued for entry service, and the order in which different entry queues are considered for service. The queuing policy is specified by a Queuing_Policy pragma. 
7/5
Three queuing policies, FIFO_Queuing, Ordered_FIFO_Queuing, and Priority_Queuing, are language defined. If no Queuing_Policy pragma applies to any of the program units comprising the partition, the queuing policy for that partition is FIFO_Queuing. The rules for the FIFO_Queuing policy are specified in 9.5.3 and 9.7.1.
7.1/5
 The Ordered_FIFO_Queuing policy is defined as follows:
7.2/5
Calls are selected on a given entry queue in order of arrival.
7.3/5
When more than one condition of an entry_barrier of a protected object becomes True, and more than one of the respective queues is nonempty, the call that arrived first is selected.
7.4/5
If the expiration time of two or more open delay_alternatives is the same and no other accept_alternatives are open, the sequence_of_statements of the delay_alternative that is first in textual order in the selective_accept is executed.
7.5/5
When more than one alternative of a selective_accept is open and has queued calls, the alternative whose queue has the call that arrived first is selected. 
8
The Priority_Queuing policy is defined as follows:
9
The calls to an entry (including a member of an entry family) are queued in an order consistent with the priorities of the calls. The priority of an entry call is initialized from the active priority of the calling task at the time the call is made, but can change later. Within the same priority, the order is consistent with the calling (or requeuing, or priority setting) time (that is, a FIFO order).
10/1
After a call is first queued, changes to the active priority of a task do not affect the priority of the call, unless the base priority of the task is set while the task is blocked on an entry call.
11
When the base priority of a task is set (see D.5), if the task is blocked on an entry call, and the call is queued, the priority of the call is updated to the new active priority of the calling task. This causes the call to be removed from and then reinserted in the queue at the new active priority. 
12
When more than one condition of an entry_barrier of a protected object becomes True, and more than one of the respective queues is nonempty, the call with the highest priority is selected. If more than one such call has the same priority, the call that is queued on the entry whose declaration is first in textual order in the protected_definition is selected. For members of the same entry family, the one with the lower family index is selected.
13
If the expiration time of two or more open delay_alternatives is the same and no other accept_alternatives are open, the sequence_of_statements of the delay_alternative that is first in textual order in the selective_accept is executed.
14
When more than one alternative of a selective_accept is open and has queued calls, an alternative whose queue has the highest-priority call at its head is selected. If two or more open alternatives have equal-priority queued calls, then a call on the entry in the accept_alternative that is first in textual order in the selective_accept is selected.

Implementation Permissions

15/5
Implementations are allowed to define other queuing policies, but are not required to support specifying more than one queuing policy per partition. 
15.1/2
  Implementations are allowed to defer the reordering of entry queues following a change of base priority of a task blocked on the entry call if it is not practical to reorder the queue immediately.

Implementation Advice

16
The implementation should use names that end with “_Queuing” for implementation-defined queuing policies.

Static Semantics

17/5
For a task type (including the anonymous type of a single_task_declaration), protected type (including the anonymous type of a single_protected_declaration), or an entry_declaration, the following language-defined representation aspect may be specified:
18/5
Max_Entry_Queue_Length

The type of aspect Max_Entry_Queue_Length is Integer.
19/5
If directly specified, the aspect_definition shall be a static expression no less than -1. If not specified, the aspect has value -1 (representing no additional restriction on queue length). 

Legality Rules

20/5
If the Max_Entry_Queue_Length aspect for a type has a nonnegative value, the Max_Entry_Queue_Length aspect for every individual entry of that type shall not be greater than the value of the aspect for the type. The Max_Entry_Queue_Length aspect of a type is nonoverridable (see 13.1.1).

Post-Compilation Rules

21/5
If a restriction Max_Entry_Queue_Length applies to a partition, any value specified for the Max_Entry_Queue_Length aspect specified for the declaration of a type or entry in the partition shall not be greater than the value of the restriction.

Dynamic Semantics

22/5
If a nonconfirming value is specified for Max_Entry_Queue_Length for a type, and an entry call or requeue would cause the queue for any entry of the type to become longer than the specified value, then Program_Error is raised at the point of the call or requeue.
23/5
If a nonconfirming value is specified for Max_Entry_Queue_Length for an entry, and an entry call or requeue would cause the queue for an entry to become longer than the specified value, then Program_Error is raised at the point of the call or requeue. 

Contents   Index   References   Search   Previous   Next 
Ada-Europe Ada 2005 and 2012 Editions sponsored in part by Ada-Europe