Fix code used when atomic ops are unavailable.
Clean up the feature #ifdef mess.