File : queue_test_dispatching.adb


with Queue_Pack_Abstract; use Queue_Pack_Abstract;
with Queue_Pack_Concrete; use Queue_Pack_Concrete;

procedure Queue_Test_Dispatching is

   type Queue_Class is access all Queue_Type'class;

   task Queue_Holder is -- could be on an individual partition
      entry Queue_Filled;
   end Queue_Holder;

   task Queue_User is   -- could be on an individual partition
      entry Send_Queue (Remote_Queue: in Queue_Class);
   end Queue_User;

   task body Queue_Holder is
      Local_Queue : Queue_Class;
      Item        : Element;
   begin
      Local_Queue := new Real_Queue; -- could be a different implementation!
      Queue_User.Send_Queue (Local_Queue);
      accept Queue_Filled do
         Dequeue (Item, Local_Queue.all); -- Item will be 'r'
      end Queue_Filled;
   end Queue_Holder;

   task body Queue_User is
      Local_Queue : Queue_Class;
      Item        : Element;
   begin
      Local_Queue := new Real_Queue; -- could be a different implementation!
      accept Send_Queue (Remote_Queue: in Queue_Class) do
         Enqueue ('r', Remote_Queue.all); -- potentially a rpc!
         Enqueue ('l', Local_Queue.all);
      end Send_Queue;
      Queue_Holder.Queue_Filled;
      Dequeue (Item, Local_Queue.all); -- Item will be 'l'
   end Queue_User;

begin null; end Queue_Test_Dispatching;