Skip to content

面渣JUC #_28 勘误 #190

@yuefengw

Description

@yuefengw

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

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

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