Example #1
0
 private static void waitUntilReady() {
   synchronized (readyLock) {
     while (readyCnt < nCouples) {
       try {
         readyLock.wait();
       } catch (InterruptedException ie) {
         ie.printStackTrace();
       }
     }
   }
 }
Example #2
0
 private static void notifyReady() {
   synchronized (semaphore) {
     synchronized (readyLock) {
       readyCnt++;
       readyLock.notifyAll();
     }
     try {
       semaphore.wait();
     } catch (InterruptedException ie) {
       ie.printStackTrace();
     }
   }
 }