D.10.1 Synchronous Barriers
1/3
{
AI05-0174-1}
This clause introduces a language-defined package to synchronously release
a group of tasks after the number of blocked tasks reaches a specified
count value.
Static Semantics
2/3
{
AI05-0174-1}
The following language-defined library package exists:
3/3
package Ada.Synchronous_Barriers
is
pragma Preelaborate(Synchronous_Barriers);
4/3
subtype Barrier_Limit
is Positive
range 1 ..
implementation-defined;
4.a.1/3
Implementation defined: The value of
Barrier_Limit'Last in Synchronous_Barriers.
5/3
type Synchronous_Barrier (Release_Threshold : Barrier_Limit)
is limited private;
6/3
procedure Wait_For_Release (The_Barrier :
in out Synchronous_Barrier;
Notified :
out Boolean);
7/3
private
-- not specified by the language
end Ada.Synchronous_Barriers;
8/3
Dynamic Semantics
9/3
{
AI05-0174-1}
Each call to Wait_For_Release blocks the calling task until the number
of blocked tasks associated with the Synchronous_Barrier object is equal
to Release_Threshold, at which time all blocked tasks are released. Notified
is set to True for one of the released tasks, and set to False for all
other released tasks.
10/3
{
AI05-0174-1}
The mechanism for determining which task sets Notified to True is implementation
defined.
11/3
{
AI05-0174-1}
Once all tasks have been released, a Synchronous_Barrier object may be
reused to block another Release_Threshold number of tasks.
12/3
{
AI05-0174-1}
As the first step of the finalization of a Synchronous_Barrier, each
blocked task is unblocked and Program_Error is raised at the place of
the call to Wait_For_Release.
13/3
{
AI05-0174-1}
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.
13.a.1/3
Implementation defined: When an aborted
task that is waiting on a Synchronous_Barrier is aborted.
14/3
Bounded (Run-Time) Errors
15/3
{
AI05-0174-1}
It is a bounded error to call Wait_For_Release on a Synchronous_Barrier
object after that object is finalized. If the error is detected, Program_Error
is raised. Otherwise, the call proceeds normally, which may leave a task
blocked forever.
Extensions to Ada 2005
15.a/3
{
AI05-0174-1}
The package Ada.Synchronous_Barriers is new.
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe