-
Notifications
You must be signed in to change notification settings - Fork 813
Open
Description
in c-020_01_interview NotifyFreeLock.java
wait should in a while loop.
ew Thread(() -> {
synchronized(lock) {
System.out.println("t2启动");
if(c.size() != 5) {
try {
lock.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
System.out.println("t2 结束");
//通知t1继续执行
lock.notify();
}
}, "t2").start();
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels