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

Use MonitorLocker rather than MutexLocker when wait/notify used

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 13
    • 13
    • hotspot
    • None
    • b19

      The pattern:
      MutexLocker ml(x_lock);
      x_lock->wait();

      Should be replaced with:
      MonitorLocker ml(x_lock);
      ml.wait();

      Then the wait call wouldn't have to differentiate whether it needs a safepoint check based on the way the lock was acquired in the MutexLocker constructors. Also, it would prevent using the wrong lock in the wait.

      The one MonitorLocker that is NULL should be made non-null and NULL MonitorLocker should be disallowed.

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

              Created:
              Updated:
              Resolved: