AbstractQueuedSynchronizer的Node状态

Node.SIGNAL 这个是什么意思?是后继节点对应的线程需要运行?还是自己这个节点对应的线程等待被唤醒?

慕桂英3389331
浏览 771回答 2
2回答

凯哥Java

源码中对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方法必须首先表明它们需要信号,然后重试原子获取,然后在失败时阻塞。  可以理解为当前线程在释放锁后,将要唤醒后续节点。       

慕森卡

waitStatus value to indicate successor's thread needs unparking后续的节点需要被唤醒
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java