< prev index next >

src/hotspot/share/jfr/utilities/jfrTryLock.hpp

Print this page

        

@@ -34,11 +34,11 @@
  private:
   volatile int* const _lock;
   bool _has_lock;
 
  public:
-  JfrTryLock(volatile int* lock) : _lock(lock), _has_lock(Atomic::cmpxchg(1, lock, 0) == 0) {}
+  JfrTryLock(volatile int* lock) : _lock(lock), _has_lock(Atomic::cmpxchg(lock, 0, 1) == 0) {}
 
   ~JfrTryLock() {
     if (_has_lock) {
       OrderAccess::fence();
       *_lock = 0;
< prev index next >