with Encapsulate;
use Encapsulate;
with Text_Io;
use Text_Io;
procedure Test_Shared is

    Local : Composite := Set_To (-1);

    task A;

    task B;

    task C;

    procedure Put (C : Character; I : Integer);

    task body A is
    begin
        Read (Local);
        Put ('A', Value_Of (Local));

        Write (Set_To (1));

        Read (Local);
        Put ('A', Value_Of (Local));

        Write (Set_To (2));

        Read (Local);
        Put ('A', Value_Of (Local));
    end A;

    task body B is
    begin
        Read (Local);
        Put ('B', Value_Of (Local));

        Write (Set_To (3));

        Read (Local);
        Put ('B', Value_Of (Local));
    end B;

    task body C is
    begin
        Write (Set_To (4));

        Read (Local);
        Put ('C', Value_Of (Local));

        Write (Set_To (5));

        Read (Local);
        Put ('C', Value_Of (Local));
    end C;

    procedure Put (C : Character; I : Integer) is
    begin
        Msg.Put ("Task " & C & " read the value " & Integer'Image (I));
    end Put;

begin
    null;
end Test_Shared;



