On 22 February 2013 07:24, James M. Lawrence <llmjjmll@...> wrote:
> It seems to me that the single CAS in ENQUEUE provides necessary and
> sufficient ordering.
> After a thread writes to the tail slot, another thread may read the
> old tail for some length of time. If so then that's fine -- CAS will
> fail for some number of iterations, and no harm is done.
> Therefore a write to the tail slot is always preceded by a valid read.
> And a valid read must have been preceded by a completed write.
> Therefore writes to the tail slot are ordered as a consequence of CAS
> writes being ordered.
Seems correct to me. Comparing disassembly could be instructive. (If
CPXCHG is used without LOCK prefix, that would do the trick, for