rawhtml258
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;