< prev index next >

src/hotspot/os/posix/os_posix.cpp

Print this page

        

@@ -1898,11 +1898,11 @@
   int v;
 
   // atomically decrement _event
   for (;;) {
     v = _event;
-    if (Atomic::cmpxchg(v - 1, &_event, v) == v) break;
+    if (Atomic::cmpxchg(&_event, v, v - 1) == v) break;
   }
   guarantee(v >= 0, "invariant");
 
   if (v == 0) { // Do this the hard way by blocking ...
     int status = pthread_mutex_lock(_mutex);

@@ -1938,11 +1938,11 @@
 
   int v;
   // atomically decrement _event
   for (;;) {
     v = _event;
-    if (Atomic::cmpxchg(v - 1, &_event, v) == v) break;
+    if (Atomic::cmpxchg(&_event, v, v - 1) == v) break;
   }
   guarantee(v >= 0, "invariant");
 
   if (v == 0) { // Do this the hard way by blocking ...
     struct timespec abst;
< prev index next >