with Ada.Text_IO; use Ada.Text_IO;
with Ada.Calendar; use Ada.Calendar;
with Exceptions; use Exceptions;
pragma Elaborate_All (Exceptions);
package body Dynamic_Tasks is
Start_Up_Time : constant Time := Clock;
No_of_Iterations : constant Positive := 4;
Delay_Per_Iteration : constant Duration := 1.0;
subtype Repeat_for is Positive range 1 .. No_of_Iterations;
task body Dynamic_Task is
begin
accept Start;
if Id = 2 then
raise Dynamic_Task_is_not_too_well;
end if;
for i in Repeat_for loop
Put_Line ("Task" & Dynamic_Id_Range'Image (Id) & " at" & Duration'Image (Clock - Start_Up_Time) & " seconds since start up");
delay Delay_Per_Iteration;
end loop;
exception
when X_Id : others => Show_Exception (X_Id);
end Dynamic_Task;
end Dynamic_Tasks;