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

Does Mutex need to also add a fence()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 13
    • hotspot

      From discussion related to PR https://github.com/openjdk/jdk/pull/21295

      [~rehn] points out:
      The old implementation cleary had this as it specification (before we switched to pthread):

      // See orderAccess.hpp. We assume throughout the VM that mutex lock and
      // try_lock do fence-lock-acquire, and that unlock does a release-unlock,
      // *in that order*. If their implementations change such that these
      // assumptions are violated, a whole lot of code will break.

      This code is written for that documented behavior.
      Hence I instead suggest to create a stricter mutex which follows the old semantics.

      In the linked bug, reads of thread state for handshakes are floating up before the mutex that assumes that the handshakee thread is safe because of this assumption.

            Unassigned Unassigned
            coleenp Coleen Phillimore
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: