这是RedSpider社区成员原创与维护的Java多线程系列文章。
Geek Repo:Geek Repo
Github PK Tool:Github PK Tool
CapriWits opened this issue 2 years ago · comments
章节 11 AQS
相关截图或文字
public final void acquire(int arg) { if (!tryAcquire(arg) && acquireQueued(addWaiter(Node.EXCLUSIVE), arg)) selfInterrupt(); }
修正意见 根据源码,tryAcquire 成功后,外部取非,退出 if 语句,不执行 selfInterrupt(),与图示不符。(成功获得锁,再自己中断相矛盾)