Add atomic_write() functions to atomic.h

This adds `atomic_write()` functions to *atomic.h*. They allow for an atomic write into the given integers, in a sense, that writing does not produce a non-atomic intermediate (screwed up) state.

*I checked with Danilo for the validity of that implementation.*

Unit tests included...