/*
* Copyright@ 2011 www.egtry.com
*/
package egtry.thread;
import java.util.concurrent.CountDownLatch;
public class CountDownLatch1Test {
public static void main(String[] args) throws InterruptedException {
CountDownLatch latch=new CountDownLatch(2);
latch.countDown();
latch.countDown();
latch.await(); //it would block if countDown had not been called twice
System.out.println("await call returns successfully");
}
}
await call returns successfully