猿问

Java里面的wait是暂停当前的thread 还是暂停调用它的thread?

Java里面的wait是暂停当前的thread 还是暂停调用它的thread?

德玛西亚99
浏览 542回答 4
4回答

红颜莎娜

wait()的作用是让当前线程进入等待状态,同时,wait()也会让当前线程释放它所持有的锁。“直到其他线程调用此对象的 notify() 方法或 notifyAll() 方法”,当前线程被唤醒(进入“就绪状态”)

一只斗牛犬

wait()Causes the current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object.

一只萌萌小番薯

当前线程肯定是与调用它的线程是同一个啊。
随时随地看视频慕课网APP

相关分类

Java
我要回答