Working on the new library design.

Added implementation of atomic ops with gcc __atomic intrinsics.
Implemented the unified atomic interface. Extracted atomic_flag to a
separate header. atomic_flag now follows standard requirements for
static initialization, if possible.