with Ada.Text_IO; use Ada.Text_IO; procedure Tasking is protected Counter is procedure Bump; function Value return Natural; private N : Natural := 0; end Counter; protected body Counter is procedure Bump is begin N := N + 1; end Bump; function Value return Natural is begin return N; end Value; end Counter; task type Worker (Id : Positive); task body Worker is pragma Unreferenced (Id); begin for I in 1 .. 10_000 loop Counter.Bump; end loop; end Worker; begin declare T1 : Worker (1); T2 : Worker (2); T3 : Worker (3); begin null; end; -- qui le tre task sono terminate Put_Line ("incrementi totali:" & Natural'Image (Counter.Value) & " (attesi 30000)"); end Tasking;