|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 4096 (0x1000) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, procedure Tasker, seg_05827b
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« └─⟦this⟧
-- DEMONSTRATION PROGRAM: -- -- Producer Consumer Tasking example -- with Text_Io; use Text_Io; procedure Tasker is ------------------------------------------------------------------------ task Buffer is entry Read (C : out Integer); entry Write (C : in Integer); end Buffer; task body Buffer is Pool_Size : constant Integer := 3; Pool : array (Integer range 1 .. Pool_Size) of Integer; Count : Integer range 0 .. Pool_Size := 0; In_Index, Out_Index : Integer range 1 .. Pool_Size := 1; begin loop select when Count < Pool_Size => accept Write (C : in Integer) do Pool (In_Index) := C; end Write; In_Index := In_Index mod Pool_Size + 1; Count := Count + 1; or when Count > 0 => accept Read (C : out Integer) do C := Pool (Out_Index); end Read; Out_Index := Out_Index mod Pool_Size + 1; Count := Count - 1; or terminate; end select; end loop; end Buffer; ------------------------------------------------------------------------ task Producer; task body Producer is begin for Count in 1 .. 6 loop Put_Line ("Entry call to write in buffer number: " & Integer'Image (Count)); Buffer.Write (Count); Put_Line ("Entry call to write complete."); end loop; Buffer.Write (0); end Producer; ------------------------------------------------------------------------ task Consumer; task body Consumer is use Text_Io; Count : Integer; begin loop Put_Line ("Entry call to read to get number."); Buffer.Read (Count); exit when Count = 0; Put_Line ("Entry call to read obtained number: " & Integer'Image (Count)); end loop; end Consumer; ------------------------------------------------------------------------ begin null; end Tasker; pragma Main;
nblk1=3 nid=0 hdr6=6 [0x00] rec0=21 rec1=00 rec2=01 rec3=046 [0x01] rec0=23 rec1=00 rec2=02 rec3=042 [0x02] rec0=0e rec1=00 rec2=03 rec3=000 tail 0x21765870687e27d32f746 0x42a00088462060003