lock
2019-06-03 10:14:28 0 举报
lock的过程
作者其他创作
大纲/内容
lock()
Unsafe
new NonfairSync/FailSync();
new ReentrantLock()
首先是类的结构图
ReentrantLock
AbstractQueuedSynchronizer
acquire(1)
tryAcquire(1)
static final class NonfairSync
+ lock()+tryAcquire(acquires):boolean
Sync
abstract static class Sync
ReentrantLock:sync = new NonfairSync()
+ lock:abstract+ nonfairTryAcquire:acquires+ tryRelease(releases):boolean+ newCondition():ConditionObject+ tryRelease(releases):boolean
false
nonfairTryAcquire(1)
getState()
setExclusiveOwnerThread(Thread thread)
true
static final class FairSync
0 条评论
回复 删除
下一页