T.2. Task Types - JulTob/Ada GitHub Wiki

You can set multiple of similar tasks with task types.


with Ada.Text_IO;
use  Ada.Text_IO;
procedure Task_Test is
    task type Repeat;

    task body Repeat is
    begin
        for I in 1..5 loop
            Put_Line ("Hello!");
            delay 2.0;
        end loop;
    end Repeat;

    A, B : Repeat;      -- declare two tasks
begin                   -- both tasks are started at this point
    null;
end Task_Test;          -- wait here for both tasks to end