3 回答
TA贡献1813条经验 获得超2个赞
wait
Object
Thread
Thread
private final Object lock = new Object();
private static final class Lock { }private final Object lock = new Lock();
wait
notify
/notifyAll
synchronized
while
synchronized (lock) { while (!isWakeupNeeded()) { lock.wait(); }}
synchronized (lock) { makeWakeupNeeded(); lock.notifyAll();}
java.util.concurrent.locks
java.util.concurrent.atomic
java.util.concurrent
TA贡献1852条经验 获得超1个赞
抛出IllegalMonitorException表示线程试图在对象的监视器上等待,或者通知在对象监视器上等待的其他线程,而不拥有指定的监视器。
同步(对象)
对象.等待()
添加回答
举报