ReentrantLock的lock流程
2021-07-26 09:58:15 1 举报
ReentrantLock的lock流程
作者其他创作
大纲/内容
thread == exclusiveOwnerThread?
tryAcquire(1)
noFairSync#tryAcqiure(1)
acquire(1)
setState
N
Y
NonfairSync#lock()
CAS?state 0->1
Sync#lock()
addWaiter
获得锁
acquireQueue
state == 0?
FairSync#lock()
threadstate
setExclusiveOwnerThread()
CAS?state 0->1
lock()
0 条评论
下一页