|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: B T
Length: 2153 (0x869)
Types: TextFile
Names: »B«
└─⟦180fe333a⟧ Bits:30000405 8mm tape, Rational 1000, SW CATALOG, 10_20_0
└─⟦180fe333a⟧ Bits:30000537 8mm tape, Rational 1000, SW Catalog 10_20_0
└─⟦5cb1d1d7f⟧ »DATA«
└─⟦3b1ee7bd8⟧
└─⟦this⟧
package body Task_Pack_8 is
task body Buffer_Type is
type Buffer_Range is range 0 .. 20;
subtype Buffer_Index is Buffer_Range range 1 .. Buffer_Range'Last;
Buffer : array (Buffer_Index) of Integer;
Head, Tail : Buffer_Index := Buffer_Index'First;
Buffer_Count : Buffer_Range := 0;
begin
loop
select
when Buffer_Count < Buffer_Range'Last =>
accept Take_Item (Item : in Integer) do
Buffer (Head) := Item;
Head := (Head mod Buffer_Range'Last) + 1;
Buffer_Count := Buffer_Count + 1;
end Take_Item;
or
when Buffer_Count > 0 =>
accept Give_Item (Item : out Integer) do
Item := Buffer (Tail);
Tail := (Tail mod Buffer_Range'Last) + 1;
Buffer_Count := Buffer_Count - 1;
end Give_Item;
end select;
end loop;
end Buffer_Type;
task body Producer_Type is
Number_To_Produce : Natural;
begin
loop
accept Produce (Count : in Natural) do
Number_To_Produce := Count;
end Produce;
for I in 1 .. Number_To_Produce loop
Buffer_Task.Take_Item (I);
end loop;
end loop;
end Producer_Type;
task body Consumer_Type is
Number_To_Consume : Natural;
Count_Check : Natural := 0;
Item : Integer;
begin
loop
accept Consume (Count : in Natural) do
Number_To_Consume := Count;
end Consume;
for I in 1 .. Number_To_Consume loop
Buffer_Task.Give_Item (Item);
Count_Check := Count_Check + 1;
end loop;
accept Wait_For_Consumer_Completion (Check : out Natural) do
Check := Count_Check;
Count_Check := 0; -- ready for next use
end Wait_For_Consumer_Completion;
end loop;
end Consumer_Type;
end Task_Pack_8;