CVS difference for ai05s/ai05-0174-1.txt
--- ai05s/ai05-0174-1.txt 2010/08/20 04:07:17 1.7
+++ ai05s/ai05-0174-1.txt 2010/10/19 03:51:18 1.8
@@ -1,4 +1,4 @@
-!standard D.10.1 (00) 10-08-12 AI05-0174-1/04
+!standard D.10.1 (00) 10-10-18 AI05-0174-1/05
!class Amendment 09-10-23
!status Amendment 2012 10-08-12
!status ARG Approved 10-0-0 10-06-19
@@ -12,8 +12,8 @@
!summary
-Add a Synchronous_Barrier type to allow many tasks to be blocked and be released
-at once.
+A Synchronous_Barrier type is added to allow many tasks to be blocked and be released
+together.
!problem
@@ -32,7 +32,7 @@
scheduling them and releasing them would remove almost any gains made through
parallelizing them in the first place.
-The synchronous barrier release paradigm is that N-1 tasks are blocked on a
+The synchronous barrier release paradigm is that N-1 tasks are blocked at a
common place waiting for release. One task is executing the sequential code
prior to the parallel release. When that task suspends, the release condition is
satisfied and all callers can execute. One of the callers is designated as the
@@ -42,7 +42,7 @@
We implement this functionality as an Ada package, a child of Ada:
package Ada.Synchronous_Barriers is
- pragma Pure(Synchronous_Barriers);
+ pragma Preelaborate(Synchronous_Barriers);
subtype Barrier_Limit is Positive range 1 .. <implementation-defined>;
@@ -51,19 +51,21 @@
procedure Wait_For_Release (The_Barrier : in out Synchronous_Barrier;
Notified : out Boolean);
+private
+ -- not specified by the language
end Ada.Synchronous_Barriers;
When a variable of type Synchronous_Barrier is created with Number_Waiting = N,
there are no waiting tasks and the barrier is set to block tasks. When the count
-reaches N, all tasks are simultaneously released and the "Released_Last" out
+reaches N, all tasks are simultaneously released and the "Notified" out
parameter is set to True in an arbitrary one of the callers. All other callers
-result in "Released_Last" being set to False upon returning from the call.
+result in "Notified" being set to False upon returning from the call.
Since it is expected that this functionality will often be mapped to hardware
with a maximum number of release gates in a barrier construct, the maximum
number of tasks that can be released using Synchronous_Barriers is
-implementation-defined. A system parameter, Max_Parallel_Release, provides this
-limit.
+implementation-defined. This limit can be queried by a program by using
+Barrier_Limit'Last.
!wording
@@ -111,7 +113,7 @@
task is unblocked and Program_Error is raised at the place of the call to
Wait_For_Release.
-It is implementation-defined whether an abnormal task which is waiting on a
+It is implementation defined whether an abnormal task which is waiting on a
Synchronous_Barrier object is aborted immediately or aborted when the tasks
waiting on the object are released.
@@ -166,7 +168,8 @@
entry subprogram barrier condition. In a sequential version of the program, the
final task performs this action and does not need to wait.
-Another AI is needed to address this need. This AI is only focused on the
+Another AI is needed to address the protected object needs [and this was not
+proposed for Ada 2012 - Editor]. This AI is only focused on the
Synchronous_Barriers package.
!example
@@ -181,29 +184,29 @@
Barrier : Barriers.Synchronous_Barrier (Number_Waiting => Number_Of_Tasks);
- task type Worker is
- end Worker;
+ task type Worker;
+
task body Worker is
- Released_Last : Boolean := False;
+ Notified : Boolean := False;
begin
- Barriers.Wait_For_Release (Barrier, Released_Last);
+ Barriers.Wait_For_Release (Barrier, Notified);
- if Released_Last then
- Put_Line ("Released Last!" & Task_Identification.Image
+ if Notified then
+ Put_Line ("Notified!" & Task_Identification.Image
(T => Task_Identification.Current_Task));
end if;
end Worker;
Worker_Array : array (1 .. Number_Of_Tasks - 1) of Worker;
- Released_Last : Boolean := False;
+ Notified : Boolean := False;
begin
delay 5.0;
- Barriers.Wait_For_Release (Barrier, Released_Last);
+ Barriers.Wait_For_Release (Barrier, Notified);
- if Released_Last then
- Put_Line ("Released Last!" & Task_Identification.Image
+ if Notified then
+ Put_Line ("Notified!" & Task_Identification.Image
(T => Task_Identification.Current_Task));
end if;
end Test_Barriers;
@@ -254,7 +257,7 @@
task is unblocked and Program_Error is raised at the place of the call to
Wait_For_Release.
-It is implementation-defined whether an abnormal task which is waiting on a
+It is implementation defined whether an abnormal task which is waiting on a
Synchronous_Barrier object is aborted immediately or aborted when the tasks
waiting on the object are released.
Questions? Ask the ACAA Technical Agent