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

with Instrument;
use Instrument;

procedure Tptcb2 is

    task Head is
        entry Give;
    end Head;
    task Link1 is
        entry Give;
    end Link1;
    task Link2 is
        entry Give;
    end Link2;
    task Link3 is
        entry Give;
    end Link3;
    task Link4 is
        entry Give;
    end Link4;
    task Link5 is
        entry Give;
    end Link5;
    task body Head is
    begin
        Start ("TPTCB2", "Task Perf., Task Chain, length 5 (test)");
        for I in 1 .. 1000 loop
            Link1.Give;
            accept Give do
                null;
            end Give;
        end loop;
        Stop;
        abort Link1, Link2, Link3, Link4, Link5;
    end Head;
    task body Link1 is
    begin
        loop
            accept Give do
                null;
            end Give;
            Link2.Give;
        end loop;
    end Link1;
    task body Link2 is
    begin
        loop
            accept Give do
                null;
            end Give;
            Link3.Give;
        end loop;
    end Link2;
    task body Link3 is
    begin
        loop
            accept Give do
                null;
            end Give;
            Link4.Give;
        end loop;
    end Link3;
    task body Link4 is
    begin
        loop
            accept Give do
                null;
            end Give;
            Link5.Give;
        end loop;
    end Link4;
    task body Link5 is
    begin
        loop
            accept Give do
                null;
            end Give;
            Head.Give;
        end loop;
    end Link5;
begin
    null;
end Tptcb2;