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