src/hotspot/share/utilities/waitBarrier_generic.cpp
changeset 59252 623722a6aeb9
parent 59249 29b0d0b61615
--- a/src/hotspot/share/utilities/waitBarrier_generic.cpp	Mon Nov 25 12:32:40 2019 +0100
+++ b/src/hotspot/share/utilities/waitBarrier_generic.cpp	Mon Nov 25 12:33:15 2019 +0100
@@ -48,7 +48,7 @@
   assert(w > 0, "Bad counting");
   // We need an exact count which never goes below zero,
   // otherwise the semaphore may be signalled too many times.
-  if (Atomic::cmpxchg(w - 1, &_waiters, w) == w) {
+  if (Atomic::cmpxchg(&_waiters, w, w - 1) == w) {
     _sem_barrier.signal();
     return w - 1;
   }