ReentrantLock unlock
2021-02-27 16:28:21 1 举报
ReentrantLock unlock方法流程
作者其他创作
大纲/内容
return false
h != null && h.waitStatus != 0
setState(c);
N
Y
throw new IllegalMonitorStateException();
tryRelease(arg)
Node s = node.next;
Y
return true
ReentrantLock.unlock()sync.release(1);
c == 0
Thread.currentThread() != getExclusiveOwnerThread()
unparkSuccessor(h);
s = t;
free = true;setExclusiveOwnerThread(null);
t.waitStatus <= 0
t != null && t != node
end
int ws = node.waitStatus;
int c = getState() - releases;
s == null || s.waitStatus > 0
t = t.prev
s != null
Node h = head;
LockSupport.unpark(s.thread);
unparkSuccessor(Node node)唤醒节点的后续节点如果存在
tryRelease(int releases)
return free;
s = null;Node t = tail;
boolean free = false;
ws < 0
收藏
收藏
0 条评论
下一页