Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8366121

Hotspot Style Guide should document conventions for lock-free code

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • 26
    • None
    • hotspot

      Proposed text:

      ---

      Sometimes variables are accessed concurrently without appropriate synchronization context, such as a held mutex or at a safepoint. In such cases the variable should be declared `volatile` and it should NOT be accessed as a normal C++ lvalue. Rather, access should be performed via functions from `Atomic`, such as `Atomic::load`, `Atomic::store`, etc.

      This special formulation makes it more clear to maintainers that the variable is accessed concurrently in a lock-free manner.

      ---

            dholmes David Holmes
            dholmes David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: