SHARE
TWEET

Untitled

a guest Oct 10th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.concurrent.locks.Lock;
  2. import java.util.concurrent.locks.ReentrantLock;
  3.  
  4. public class NonParallelBathroom implements Bathroom {
  5.  
  6.     Lock lock;
  7.     boolean currentWCIsMale = true;
  8.     // int in = 0;
  9.    
  10.     public NonParallelBathroom(int nbBathroom) {
  11.         lock = new ReentrantLock();
  12.     }
  13.  
  14.     @Override
  15.     public void enter(Person person) {
  16.         lock.lock();
  17.     }
  18.  
  19.     @Override
  20.     public void leave(Person person) {
  21.         lock.unlock();
  22.     }
  23.  
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top