Java并发

This commit is contained in:
罗祥
2019-11-26 14:45:55 +08:00
parent 9b162124a8
commit 3884f30ffd
6 changed files with 386 additions and 7 deletions

View File

@ -32,6 +32,7 @@ public class AwaitAndSignal {
Thread thread1 = new Thread(new IncreaseTask());
thread1.start();
Thread.sleep(2000);
// 必须要再次获取该重入锁否则会抛出IllegalMonitorStateException异常
lock.lock();
condition.signal();
lock.unlock();