with Global_Options;  use Global_Options;

package body Traversal.Threaded_Display is

   ----------
   -- Show --
   ----------

   procedure Show (Solution : in Trail;  On : in Maze.Reference) is
      Solution_Location : constant Location := Safe_Position (Display.all, On);
   begin
      if Display_Output then
         Mutex.Acquire;
         Total := Total + 1;
         Traversal.Show (Solution);
         Put (Display.all,
              Integer'Image (Total) & " solution(s) ",
              Solution_Location);
         Mutex.Release;
      end if;
   end Show;

   -----------
   -- Mutex --
   -----------

   protected body Mutex is

      entry Acquire when Count > 0 is
      begin
         Count := Count - 1;
      end Acquire;

      procedure Release is
      begin
         Count := Count + 1;
      end Release;

   end Mutex;

end Traversal.Threaded_Display;

