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