Rework as patch, rather than full reimplementation
Rework as patch, rather than full reimplementation

- Use atomics-based once_flag only if the original implementation would
cause a compile error.
- Change spinlock to a yielding spinlock, to reduce CPU load.

meganz/mingw-std-threads