// if the writeBarrier is set, we want to maintain lastReplayPosition; this is an optimisation to avoid
// casing it for every write, but still ensure it is correct when writeBarrier.await() completes.
while (true)
{
ReplayPosition last = lastReplayPosition.get();
if (last.compareTo(replayPosition) >= 0)
break;
if (lastReplayPosition.compareAndSet(last, replayPosition))
break;
}
}