Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with Ada.Text_IO; use Ada.Text_IO;
- with System.Atomic_Operations.Modular_Arithmetic;
- procedure Main is
- type Unsigned_Atomic is mod 2 ** 32 with Atomic;
- package Atomic_Operations
- is new System.Atomic_Operations.Modular_Arithmetic
- (Atomic_Type => Unsigned_Atomic);
- X : aliased Unsigned_Atomic := 0;
- Loops : constant := 1_000_000;
- task type T;
- task body T is
- begin
- for J in 1 .. Loops loop
- Atomic_Operations.Atomic_Add (X, 1);
- end loop;
- end T;
- begin
- declare
- A, B : T;
- begin
- null;
- end;
- Put_Line (X'Image);
- end Main;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement