Java里面的wait是暫停當(dāng)前的thread 還是暫停調(diào)用它的thread?
4 回答

紅顏莎娜
TA貢獻(xiàn)1842條經(jīng)驗(yàn) 獲得超13個(gè)贊
wait()的作用是讓當(dāng)前線(xiàn)程進(jìn)入等待狀態(tài)
,同時(shí),wait()也會(huì)讓當(dāng)前線(xiàn)程釋放它所持有的鎖
?!爸钡狡渌€(xiàn)程調(diào)用此對(duì)象的 notify() 方法或 notifyAll() 方法”,當(dāng)前線(xiàn)程被喚醒(進(jìn)入“就緒狀態(tài)”)

一只斗牛犬
TA貢獻(xiàn)1784條經(jīng)驗(yàn) 獲得超2個(gè)贊
wait()
Causes the current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object.
添加回答
舉報(bào)
0/150
提交
取消