misc: convert code using atomics.h to stdatomic.h

Requires a C11-compatible libc. The stdatomic.h, at least as shipped by
FreeBSD and MinGW-w64 is compatible with non-C11 compilers as long as
they support at least __sync; atomics.h also had the same requirement.

This doesn't touch waf so it's doing dumb tests and not checking for
stdatomic.h's presence; this will be fixed on a following commit.
misc/ring: Use the acquire/release memory model for atomics