< prev index next >
src/hotspot/share/utilities/lockFreeStack.hpp
Print this page
@@ -63,11 +63,11 @@
T* cur = top();
T* old;
do {
old = cur;
set_next(*last, cur);
- cur = Atomic::cmpxchg(first, &_top, cur);
+ cur = Atomic::cmpxchg(&_top, cur, first);
} while (old != cur);
}
// Noncopyable.
LockFreeStack(const LockFreeStack&);
@@ -89,11 +89,11 @@
T* new_top = NULL;
if (result != NULL) {
new_top = next(*result);
}
// CAS even on empty pop, for consistent membar bahavior.
- result = Atomic::cmpxchg(new_top, &_top, result);
+ result = Atomic::cmpxchg(&_top, result, new_top);
} while (result != old);
if (result != NULL) {
set_next(*result, NULL);
}
return result;
< prev index next >