-- ada tasking tester
-- task head is the controller
-- tasks link are the chain of tasks
-- tasks idle are the standby tasks

with Instrument;
use Instrument;

procedure Tpita2 is
    Dummy : Integer;
    task Head is
        entry Give;
    end Head;
    task Link1 is
        entry Give;
    end Link1;
    task Idle1 is
        entry Init;
        entry Never;            -- included in test version
    end Idle1;
    task body Head is
    begin
        Start ("TPITA2", "Task Performance w/1 Idle task (Test)");
        Idle1.Init;
        Dummy := 0; -- something for the task to do
        for I in 1 .. 1000 loop
            Dummy := Dummy + 1;
            Link1.Give;
            accept Give do
                null;
            end Give;
        end loop;
        Stop;
        abort Link1, Idle1;
    end Head;
    task body Link1 is
    begin
        loop
            accept Give do
                null;
            end Give;
            Head.Give;
            null;
        end loop;
    end Link1;
    task body Idle1 is
    begin
        accept Init do
            null;
        end Init;
        accept Never do
            null;
        end Never;    -- inc in test ver
        null;
    end Idle1;
begin
    null;
end Tpita2;