+2011-08-29 Robert Dewar <dewar@adacore.com>
+
+ * a-synbar.ads, a-synbar.adb, a-synbar-posix.adb,
+ a-synbar-posix.ads: Minor reformatting.
+
+2011-08-29 Yannick Moy <moy@adacore.com>
+
+ * snames.ads-tmpl: Add name Force.
+
2011-08-29 Pascal Obry <obry@adacore.com>
* prj-nmsc.adb: Minor reformatting.
function pthread_barrier_init
(barrier : not null access pthread_barrier_t;
attr : System.Address := System.Null_Address;
- count : unsigned)
- return int;
+ count : unsigned) return int;
pragma Import (C, pthread_barrier_init, "pthread_barrier_init");
-- Initialize barrier with the attributes in attr. The barrier is opened
-- when count waiters arrived. If attr is null the default barrier
overriding procedure Finalize (Barrier : in out Synchronous_Barrier) is
Result : int;
-
begin
Result := pthread_barrier_destroy (Barrier.POSIX_Barrier'Access);
pragma Assert (Result = 0);
overriding procedure Initialize (Barrier : in out Synchronous_Barrier) is
Result : int;
-
begin
Result := pthread_barrier_init
(barrier => Barrier.POSIX_Barrier'Access,
procedure Wait_For_Release
(The_Barrier : in out Synchronous_Barrier;
- Notified : out Boolean)
+ Notified : out Boolean)
is
Result : int;
type Synchronous_Barrier (Release_Threshold : Barrier_Limit) is
limited private;
- procedure Wait_For_Release (The_Barrier : in out Synchronous_Barrier;
- Notified : out Boolean);
+ procedure Wait_For_Release
+ (The_Barrier : in out Synchronous_Barrier;
+ Notified : out Boolean);
private
-- POSIX barrier data type
SIZEOF_PTHREAD_BARRIER_T : constant :=
(if System.Word_Size = 64 then 32 else 20);
-- Value defined according to the linux definition in pthreadtypes.h. On
- -- other system, MIPS IRIX, the object is smaller, so it works correctly
- -- although we are wasting some space.
+ -- other system, e.g. MIPS IRIX, the object is smaller, so it works
+ -- correctly although we are wasting some space.
type pthread_barrier_t_view is (size_based, align_based);
type Synchronous_Barrier (Release_Threshold : Barrier_Limit) is
new Ada.Finalization.Limited_Controlled with
- record
- POSIX_Barrier : aliased pthread_barrier_t;
- end record;
+ record
+ POSIX_Barrier : aliased pthread_barrier_t;
+ end record;
overriding procedure Initialize (Barrier : in out Synchronous_Barrier);
overriding procedure Finalize (Barrier : in out Synchronous_Barrier);
package body Ada.Synchronous_Barriers is
protected body Synchronous_Barrier is
+
-- The condition "Wait'Count = Release_Threshold" opens the barrier when
-- the required number of tasks is reached. The condition "Keep_Open"
-- leaves the barrier open while there are queued tasks. While there are
-- barrier will remain open only for those tasks already inside.
entry Wait (Notified : out Boolean)
- when Wait'Count = Release_Threshold or else Keep_Open is
+ when Wait'Count = Release_Threshold or else Keep_Open
+ is
begin
- -- If we are executing the entry it means that the required number
- -- of tasks have been queued in the entry. Keep_Open barrier will
- -- remain true until all queued tasks are out.
+ -- If we are executing the entry it means that the required number of
+ -- tasks have been queued in the entry. Keep_Open barrier will remain
+ -- true until all queued tasks are out.
Keep_Open := Wait'Count > 0;
- -- The last released task will close the barrier and get the
- -- Notified token.
+ -- The last released task will close the barrier and get the Notified
+ -- token.
Notified := Wait'Count = 0;
end Wait;
+
end Synchronous_Barrier;
----------------------
procedure Wait_For_Release
(The_Barrier : in out Synchronous_Barrier;
- Notified : out Boolean) is
+ Notified : out Boolean)
+ is
begin
The_Barrier.Wait (Notified);
end Wait_For_Release;
+
end Ada.Synchronous_Barriers;
type Synchronous_Barrier (Release_Threshold : Barrier_Limit) is
limited private;
- procedure Wait_For_Release (The_Barrier : in out Synchronous_Barrier;
- Notified : out Boolean);
+ procedure Wait_For_Release
+ (The_Barrier : in out Synchronous_Barrier;
+ Notified : out Boolean);
private
protected type Synchronous_Barrier (Release_Threshold : Barrier_Limit) is
Name_Entry_Count : constant Name_Id := N + $;
Name_External_Name : constant Name_Id := N + $;
Name_First_Optional_Parameter : constant Name_Id := N + $;
+ Name_Force : constant Name_Id := N + $;
Name_Form : constant Name_Id := N + $;
- Name_Formal_Proof : constant Name_Id := N + $;
Name_G_Float : constant Name_Id := N + $;
Name_Gcc : constant Name_Id := N + $;
Name_Gnat : constant Name_Id := N + $;