摘要:
@ReservedStackAccess final boolean tryReadLock() { Thread current = Thread.currentThread(); // 死循环 for (;;) { int c = getState(); // 当前有别的线程持有写锁,此时尝试获 阅读全文
摘要:
static final class ThreadLocalHoldCounter extends ThreadLocal<HoldCounter> { public HoldCounter initialValue() { return new HoldCounter(); } } private 阅读全文
摘要:
static final class ThreadLocalHoldCounter extends ThreadLocal<HoldCounter> { public HoldCounter initialValue() { return new HoldCounter(); } } private 阅读全文
摘要:
// 尝试获取写锁 protected final boolean tryAcquire(int acquires) { Thread current = Thread.currentThread(); int c = getState(); // 全状态 int w = exclusiveCoun 阅读全文
摘要:
// ReentrantLock.FairSync::initialTryLock final boolean initialTryLock() { Thread current = Thread.currentThread(); int c = getState(); // c==0说明当前锁无人 阅读全文
摘要:
// 尝试获取锁 // 尝试获取成功返回true // 尝试获取失败返回false final boolean tryLock() { Thread current = Thread.currentThread(); int c = getState(); // c == 0 说明当前锁处于闲置状态 阅读全文
摘要:
/** * Unlinks the given node and other non-waiting nodes from * condition queue unless already unlinked. */ private void unlinkCancelledWaiters(Condit 阅读全文