多线程wait

当前线程变为阻塞(释锁)

放弃CPU执行


同步代码块中使用且必须要通过对象.wait(this.wait)


释锁目的: 生产者写数据,防死锁

public class Thread002 {
public static void main(String[] args) {
new Thread002().start();
}

public synchronized void start(){
try {
this.wait(3000);
}catch (Exception e){

}
}
}





 notify 唤醒锁池阻塞的线程,从就绪-->运行
原文地址:https://www.cnblogs.com/smallfa/p/14620073.html