2 回答

TA貢獻(xiàn)6條經(jīng)驗(yàn) 獲得超2個(gè)贊
源碼中對(duì)SIGNAL的解釋。
SIGNAL:? ? ?The successor of this node is (or will soon be)? blocked (via park), so the current node must? unpark its successor when it releases or? cancels.
?To avoid races, acquire methods must first indicate they need a signal,? then retry the atomic acquire, and then,? on failure, block.
翻譯后:
該節(jié)點(diǎn)的后繼者被(或很快將被阻止)(通過停放),因此當(dāng)前節(jié)點(diǎn)釋放或取消時(shí)必須取消其后繼者的停放。
為了避免種族沖突,acquire方法必須首先表明它們需要信號(hào),然后重試原子獲取,然后在失敗時(shí)阻塞。
? 可以理解為當(dāng)前線程在釋放鎖后,將要喚醒后續(xù)節(jié)點(diǎn)。? ? ? ?

TA貢獻(xiàn)1806條經(jīng)驗(yàn) 獲得超8個(gè)贊
waitStatus value to indicate successor's thread needs unparking
后續(xù)的節(jié)點(diǎn)需要被喚醒
添加回答
舉報(bào)