< prev index next >
src/hotspot/share/utilities/singleWriterSynchronizer.cpp
Print this page
@@ -42,11 +42,11 @@
// Wait until all threads that entered a critical section before
// synchronization have exited that critical section.
void SingleWriterSynchronizer::synchronize() {
// Side-effect in assert balanced by debug-only dec at end.
- assert(Atomic::add(1u, &_writers) == 1u, "multiple writers");
+ assert(Atomic::add(&_writers, 1u) == 1u, "multiple writers");
// We don't know anything about the muxing between this invocation
// and invocations in other threads. We must start with the latest
// _enter polarity, else we could clobber the wrong _exit value on
// the first iteration. So fence to ensure everything here follows
// whatever muxing was used.
@@ -62,11 +62,11 @@
// operations until this change of _enter succeeds.
uint old;
do {
old = value;
*new_ptr = ++value;
- value = Atomic::cmpxchg(value, &_enter, old);
+ value = Atomic::cmpxchg(&_enter, old, value);
} while (old != value);
// Critical sections entered before we changed the polarity will use
// the old exit counter. Critical sections entered after the change
// will use the new exit counter.
volatile uint* old_ptr = &_exit[old & 1];
< prev index next >