

A fast lock-free queue for C++ - frozenport
http://moodycamel.com/blog/2013/a-fast-lock-free-queue-for-c++

======
grundprinzip
Interesting!

One question though: Why not use the C++11 atomics with the memory order
definitions given in atomic. This should give you full platform support even
if its not implemented in your atomicops.h

Folly, for example, makes pretty much use of these implementations.

~~~
moodycamel
Author here :-) (Didn't know anyone actually read my posts! I was surprised to
find this on HN.)

The only reason I didn't use std::atomic was because MSVC2010 doesn't support
it, and I wanted it to work in MSVC2010 (2012 adds std::atomic support though,
if I remember correctly).

I agree that having a bunch of messy preprocessor-soup implementations of
atomic primitives is really ugly and not very cross-platform friendly -- in
the future I think I'll just stick to std::atomic.

atomicops.h does use std::atomic for all compilers except MSVC2010 and ICC13
(which only has partial std::atomic support).

