Skip to content

面渣JUC #_28 勘误 #190

Description

@yuefengw

原文:
synchronized 通过 JVM 指令 monitorenter 和 monitorexit,来确保加锁代码块内的指令不会被重排。

错误点:
synchronized 不禁止内部重排,而是通过 monitorenter / monitorexit 在进入和退出临界区时引入内存屏障,防止跨锁边界的指令重排。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions