next up previous contents index
Weiter:

rawhtml258 Hinauf: 19.3 Die Realisierung Zurück: 19.3.2 Transporter-Tasks


 

19.3.3 Relais-Tasks

 

Bei der Implementation eines Relais-Task's (siehe Abb. 19.9)

 
Abbildung 19.9: Relais-Task 

können wir den Task-Body von Buffer noch einmal verwenden:

generic
size: in natural := 20;
type item is private;
with procedure Consumer (C: in item);

package Generic_Relay is
procedure Enqueue (I: in item);
end Generic_Relay;

package body Generic_Relay is
task Buffer is
entry Enqueue (I: in item);
entry Dequeue (I: out item);
end Buffer;

task Transporter is
-ruftProducerundConsumer
end Transporter;

task body Transporter is
x: item;
begin
loop
Buffer.Dequeue(x);
Consumer(x);
end loop;
end Transporter;

task body Buffer is separate;

procedure Enqueue (I: in item) is
begin
Buffer.Enqueue(I);
end Enqueue;

end Generic_Relay;



Johann Blieberger
Wed Feb 11 09:58:52 MET 1998