This pull request is more of an RFC than a finished implementation.
It adds some basic atomic types, with an interface modelled off of C++11's atomic types.
It also adds free functions that provide a slightly nicer interface for atomic operations, though they are unsafe because there isn't a way to be generic over "word-sized" types.
See also #5042