1
lhx2008 Apr 12, 2020 via Android
应该是说说 AQS 的东西
|
2
tcxurun Apr 12, 2020 Reentrantlock 主要是基于 AQS,而 AQS 继承一个抽象类 AbstractOwnableSynchronizer,有个变量 exclusiveOwnerThread,用来存储锁持有的线程,然后比较,比如源码中你会看到这个
(current == getExclusiveOwnerThread()) |
3
coer Apr 12, 2020
从 lock()进去走几步就能看到 nonfairTryAcquire(int acquires)中的 else if (current == getExclusiveOwnerThread()).....
|