with Readers_Writers;
use Readers_Writers;
package body Shared_Variable is

    C : Control;

    -- for testing only: Item made "in out" instead of "out"
    procedure Read (Item : in out Object_Type) is
    begin

        select
            C.Start (Read);
        or
            delay Read_Time_Limit;
            raise Timed_Out;
        end select;

        -- for testing only; this allows the scheduler to screw up!
        Copy (From => Object, To => Item);
        -- temporarily replaces
        --    Item := Object;

        -- for testing only
        Read_Put (Item);

        C.Stop;
    end Read;

    procedure Write (Item : in Object_Type) is
    begin

        select
            C.Start (Write);
        or
            delay Write_Time_Limit;
            raise Timed_Out;
        end select;

        -- for testing only; this allows the scheduler to screw up!
        Copy (From => Item, To => Object);
        -- temporarily replaces
        Object := Item;

        -- for testing only
        Write_Put (Item);

        C.Stop;
    end Write;

end Shared_Variable;

