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";
}
}