import java.util.concurrent.Semaphore;
/**
* User:yang
*/
public class Thread{
public static void main(String[] args) throws InterruptedException {
//c初始5
Semaphore semaphore = new Semaphore(5);
//p,申请1
semaphore.acquire();
semaphore.acquire();
semaphore.acquire();
semaphore.acquire();
semaphore.acquire();
//v,释放1
System.out.println("已经5次");
semaphore.acquire();
System.out.println("第六次");
semaphore.release();
}
}