コード例 #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();
     }
   }
 }