Compilation fixes. Added public headers for atomic_flag and atomic.
Added workarounds for clang.