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