RedSpider1 / concurrent

这是RedSpider社区成员原创与维护的Java多线程系列文章。

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

11 AQS 章节 acquire 方法流程图勘误

CapriWits opened this issue · comments

章节
11 AQS

相关截图或文字
acquire流程

public final void acquire(int arg) {
    if (!tryAcquire(arg) &&
        acquireQueued(addWaiter(Node.EXCLUSIVE), arg))
        selfInterrupt();
}

修正意见
根据源码,tryAcquire 成功后,外部取非,退出 if 语句,不执行 selfInterrupt(),与图示不符。(成功获得锁,再自己中断相矛盾)