慕桂英3389331
2019-03-20 19:15:29
Node.SIGNAL 這個是什么意思?是后繼節點對應的線程需要運行?還是自己這個節點對應的線程等待被喚醒?
2 回答

凱哥Java
TA貢獻6條經驗 獲得超2個贊
源碼中對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.
翻譯后:
該節點的后繼者被(或很快將被阻止)(通過停放),因此當前節點釋放或取消時必須取消其后繼者的停放。
為了避免種族沖突,acquire方法必須首先表明它們需要信號,然后重試原子獲取,然后在失敗時阻塞。
? 可以理解為當前線程在釋放鎖后,將要喚醒后續節點。? ? ? ?
添加回答
舉報
0/150
提交
取消