All pastes #826859 Raw Edit

Anonymous

public text v1 · immutable
#826859 ·published 2007-12-21 13:53 UTC
rendered paste body
// This class also requires synchronisation to enable exclusive access to condition variables.
public class WaitingRoom { 

   private boolean passengersWaiting = false;

   public synchronized void setPassWaiting () {

     passengersWaiting = true;
       // ******************************
      // add synchronization code here
      // ******************************
   }

   public synchronized void getPassWaiting (int id) {
      try {
         System.out.println ("TRY IN PASS WAITING");
          // ******************************
         // add synchronization code here
         // ******************************
      
        } 
      catch (InterruptedException e) {System.exit (0);}
   }

   private String spaces (int id) {
      if (id == 1) return ""; else return "\t";
   }
}