DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦662dde1fc⟧ TextFile

    Length: 3452 (0xd7c)
    Types: TextFile
    Names: »B«

Derivation

└─⟦bfaa708f6⟧ Bits:30000531 8mm tape, Rational 1000, INSIGHT 1_3_0
    └─ ⟦c51948655⟧ »DATA« 
        └─⟦266b31e86⟧ 
            └─⟦this⟧ 

TextFile

with Client;
with Log_Writer;
with Queue_Generic;
package body Network is

    package Packet_Queue is new Queue_Generic (Message.Packet);

    task Buffer_Pool_Manager is
        entry Free (Pkt : Message.Packet);
        entry Allocate (Pkt : out Message.Packet);
    end Buffer_Pool_Manager;

    task Net_Queue is
        entry Add (Pkt : Message.Packet);
        entry Get (Pkt : in out Message.Packet);
    end Net_Queue;


    procedure Send (Pkt : Message.Packet) is
        Pkt_Copy : Message.Packet;
    begin
        Buffer_Pool_Manager.Allocate (Pkt_Copy);
        Message.Copy (Pkt, Pkt_Copy);
        Net_Queue.Add (Pkt_Copy);
    end Send;


    procedure Receive (Pkt : in out Message.Packet) is
        Internal_Pkt : Message.Packet;
    begin
        Net_Queue.Get (Internal_Pkt);
        Message.Copy (Internal_Pkt, Pkt);
        Buffer_Pool_Manager.Free (Internal_Pkt);
    end Receive;

    task body Buffer_Pool_Manager is
        Buffer_Queue : Packet_Queue.Queue;
    begin

        Packet_Queue.Initialize (Buffer_Queue);
        loop
            begin
                select
                    accept Allocate (Pkt : out Message.Packet) do
                        if Packet_Queue.Is_Empty (Buffer_Queue) then
                            declare
                                The_Packet : Message.Packet;
                            begin
                                Message.Initialize (The_Packet, Client.Nil);
                                Pkt := The_Packet;
                            end;
                        else
                            Pkt := Packet_Queue.First (Buffer_Queue);
                            Packet_Queue.Delete (Buffer_Queue);
                        end if;
                    end Allocate;
                or
                    accept Free (Pkt : Message.Packet) do
                        Packet_Queue.Add (Buffer_Queue, Pkt);
                    end Free;
                end select;
            exception
                when others =>
                    Log_Writer.Log_Message
                       ("Network.Buffer_Pool_Manager", "exception!");
                    delay 5.0;
            end;
        end loop;
    end Buffer_Pool_Manager;


    procedure Test_Connections is
    begin
        [statement]
    end Test_Connections;


    procedure Initialize is
    begin
        null;
    end Initialize;


    procedure Boot (Remote_Node : Node_Id; Program : Program_Id) is
    begin
        [statement]
    end Boot;


    procedure Reset (Remote_Node : Node_Id) is
    begin
        [statement]
    end Reset;


    procedure Enter_Test_Mode is
    begin
        [statement]
    end Enter_Test_Mode;


    procedure Exit_Test_Mode is
    begin
        [statement]
    end Exit_Test_Mode;

    task body Net_Queue is
        Q : Packet_Queue.Queue;
    begin
        Packet_Queue.Initialize (Q);
        loop
            begin
                select
                    accept Add (Pkt : Message.Packet) do
                        Packet_Queue.Add (Q, Pkt);
                    end Add;
                or
                    when not Packet_Queue.Is_Empty (Q) =>
                        accept Get (Pkt : in out Message.Packet) do
                            Pkt := Packet_Queue.First (Q);
                            Packet_Queue.Delete (Q);
                        end Get;
                end select;
            end;
        end loop;
    end Net_Queue;



end Network;