--  Task and protected types: two counters of one protected type, each with its own lock and
--  its own start, and two workers of one task type, told apart by a discriminant, adding to
--  both counters at once.
package Pools is
   protected type Counter (Start : Natural) is
      procedure Add (N : Natural);
      --  waits until the workers have added everything they will
      entry Wait_Full (Total_Now : out Natural);
   private
      Total : Natural := Start;
      Goal : Natural := (if Start <= Natural'Last - 30 then Start + 30 else Natural'Last);
   end Counter;

   Small : Counter (0);
   Large : Counter (100);

   subtype Worker_Id is Positive range 1 .. 100;

   task type Worker (Id : Worker_Id);

   First_Worker : Worker (1);
   Second_Worker : Worker (2);
end Pools;
