What does intrinsic lock actually mean for a Java class?

前端 未结 7 1531
逝去的感伤
逝去的感伤 2021-02-04 10:50

In order to properly understand the issues and solutions for concurrency in Java, I was going through the official Java tutorial. In one of the pages they defined Intrin

7条回答
  •  温柔的废话
    2021-02-04 11:05

    A lock can be held by only one thread at a time. That doesn't defeat the purpose; that is the purpose.

    Threads mutually exclude each other from simultaneous action in critical sections by acquiring a lock, or mutex. This provides effective atomicity around a series of distinct actions, so that other threads never see intermediate states that might violate consistency guarantees.

提交回复
热议问题