CVS difference for ai05s/ai05-0159-1.txt
--- ai05s/ai05-0159-1.txt 2009/12/11 07:15:33 1.6
+++ ai05s/ai05-0159-1.txt 2010/04/13 03:12:58 1.7
@@ -1,5 +1,6 @@
-!standard A.18.24 09-11-08 AI05-0159-1/04
+!standard A.18.24 10-04-12 AI05-0159-1/05
!class Amendment 05-10-24
+!status ARG Approved 11-0-0 10-02-27
!status work item 06-03-15
!status received 05-10-02
!priority Medium
@@ -8,7 +9,7 @@
!summary
-(See proposal.)
+Add task-safe queues to the set of containers.
!problem
@@ -18,25 +19,27 @@
!proposal
-Add task-safe queues to the set of containers.
+Add a synchronized interface and four implementations of task-safe queues.
+We suggest adding both regular queues and priority queues. In addition, there
+are bounded and unbounded versions of both kinds of queues.
!wording
-A.18.23 Containers.Synchronized_Queues
+A.18.23 Containers.Synchronized_Queue_Interfaces
-The language-defined generic package Containers.Synchronized_Queues
+The language-defined generic package Containers.Synchronized_Queue_Interfaces
provides interface type Queue, and a set of operations for that type.
Interface Queue specifies a first-in, first-out queue.
Static Semantics
-The generic library package Containers.Synchronized_Queues has the
+The generic library package Containers.Synchronized_Queue_Interfaces has the
following declaration:
generic
type Element_Type is private;
-package Ada.Containers.Synchronized_Queues is
+package Ada.Containers.Synchronized_Queue_Interfaces is
pragma Pure;
type Queue is synchronized interface;
@@ -54,7 +57,7 @@
function Current_Use (Container : Queue) return Count_Type is abstract;
function Peak_Use (Container : Queue) return Count_Type is abstract;
-end Ada.Containers.Synchronized_Queues;
+end Ada.Containers.Synchronized_Queue_Interfaces;
procedure Enqueue
(Container : in out Queue;
@@ -63,15 +66,15 @@
A queue type that implements this interface may have a bounded
*capacity*. If the queue object has a bounded capacity,
and the number of existing elements equals the capacity, then Enqueue
-blocks until storage becomes available. It then copies New_Item onto
-the tail of the queue.
+blocks until storage becomes available; otherwise Enqueue does not block.
+In any case, it then copies New_Item onto the tail of the queue.
procedure Dequeue
(Container : in out Queue;
Element : out Element_Type) is abstract;
If the queue is empty, then Dequeue blocks until an item becomes
-available. It then returns a copy of the element at the head of the
+available. In any case, it then returns a copy of the element at the head of the
queue, and removes it from the container.
function Current_Use (Container : Queue) return Count_Type is abstract;
@@ -90,15 +93,15 @@
The language-defined generic package
Containers.Unbounded_Synchronized_Queues provides type Queue, which
-implements the interface type Containers.Synchronized_Queues.Queue.
+implements the interface type Containers.Synchronized_Queue_Interfaces.Queue.
-with Ada.Containers.Synchronized_Queues;
+with Ada.Containers.Synchronized_Queue_Interfaces;
generic
- with package Queues is new Ada.Containers.Synchronized_Queues (<>);
+ with package Queue_Interfaces is new Ada.Containers.Synchronized_Queue_Interfaces (<>);
package Ada.Containers.Unbounded_Synchronized_Queues is
pragma Preelaborate;
- type Queue is synchronized new Queues.Queue with private;
+ type Queue is synchronized new Queue_Interfaces.Queue with private;
private
@@ -106,7 +109,7 @@
end Ada.Containers.Unbounded_Synchronized_Queues;
-The type Queue is used to represent queues. The type Queue needs
+The type Queue is used to represent task-safe queues. The type Queue needs
finalization (see 7.6).
The capacity for instances of type Queue is unbounded.
@@ -121,17 +124,16 @@
The language-defined generic package
Containers.Bounded_Synchronized_Queues provides type Queue, which
-implements the interface type Containers.Synchronized_Queues.Queue.
+implements the interface type Containers.Synchronized_Queue_Interfaces.Queue.
-with Ada.Containers.Synchronized_Queues;
+with Ada.Containers.Synchronized_Queue_Interfaces;
generic
- with package Queues is new Ada.Containers.Synchronized_Queues (<>);
-
+ with package Queue_Interfaces is new Ada.Containers.Synchronized_Queue_Interfaces (<>);
package Ada.Containers.Bounded_Synchronized_Queues is
pragma Pure;
type Queue (Capacity : Count_Type) is
- synchronized new Queues.Queue with private;
+ synchronized new Queue_Interfaces.Queue with private;
private
@@ -139,13 +141,13 @@
end Ada.Containers.Bounded_Synchronized_Queues;
-The type Queue is used to represent queues. The type Queue needs
-finalization if and only type Element_Type needs finalization.
+The type Queue is used to represent task-safe queues. The type Queue needs
+finalization if and only if type Element_Type needs finalization.
The capacity for instances of type Queue is bounded and specified
by the discriminant Capacity.
-AARM Ramification: Since this type has a bounded capacity, Enqueue may block
+AARM Ramification: Since this type has a bounded capacity, Enqueue might block
if the queue is full.
Implementation Advice
@@ -160,18 +162,17 @@
The language-defined generic package
Containers.Unbounded_Priority_Queues provides type Queue, which
-implements the interface type Containers.Synchronized_Queues.Queue.
+implements the interface type Containers.Synchronized_Queue_Interfaces.Queue.
-with Ada.Containers.Synchronized_Queues;
+with Ada.Containers.Synchronized_Queue_Interfaces;
generic
- with package Queues is new Ada.Containers.Synchronized_Queues (<>);
+ with package Queue_Interfaces is new Ada.Containers.Synchronized_Queue_Interfaces (<>);
with function Before
(Left, Right : Queues.Element_Type) return Boolean is <>;
-
package Ada.Containers.Unbounded_Priority_Queues is
pragma Preelaborate;
- type Queue is synchronized new Queues.Queue with private;
+ type Queue is synchronized new Queue_Interfaces.Queue with private;
private
@@ -179,8 +180,8 @@
end Ada.Containers.Unbounded_Priority_Queues;
-The type Queue is used to represent queues. The type Queue needs
-finalization (see 7.6).
+The type Queue is used to represent task-safe priority queues. The type Queue
+needs finalization (see 7.6).
The capacity for instances of type Queue is unbounded.
@@ -209,19 +210,18 @@
The language-defined generic package
Containers.Bounded_Priority_Queues provides type Queue, which
-implements the interface type Containers.Synchronized_Queues.Queue.
+implements the interface type Containers.Synchronized_Queue_Interfaces.Queue.
-with Ada.Containers.Synchronized_Queues;
+with Ada.Containers.Synchronized_Queue_Interfaces;
generic
- with package Queues is new Ada.Containers.Synchronized_Queues (<>);
+ with package Queue_Interfaces is new Ada.Containers.Synchronized_Queue_Interfaces (<>);
with function Before
(Left, Right : Queues.Element_Type) return Boolean;
-
package Ada.Containers.Bounded_Priority_Queues is
pragma Pure;
type Queue (Capacity : Count_Type) is
- synchronized new Queues.Queue with private;
+ synchronized new Queue_Interfaces.Queue with private;
private
@@ -230,8 +230,8 @@
end Ada.Containers.Bounded_Priority_Queues;
-The type Queue is used to represent queues. The type Queue needs
-finalization if and only type Element_Type needs finalization.
+The type Queue is used to represent task-safe priority queues. The type Queue
+needs finalization if and only if type Element_Type needs finalization.
The capacity for instances of type Queue is bounded and specified
by the discriminant Capacity.
@@ -285,7 +285,7 @@
package Widgets is
type Widget is new Integer; -- for example
...
- end Widgets;
+ end Widgets;
package Widget_Queue_Types is
new Ada.Containers.Synchronized_Queues (Widgets.Widget);
@@ -376,7 +376,7 @@
begin -- activate tasks
null;
end;
-
+
!ACATS test
ACATS Tests are needed for these new packages.
Questions? Ask the ACAA Technical Agent