C++11 atomics: does it make sense, or is it even possible, to use them with memory mapped I/O?
问题 As I understand it, C volatile and optionally inline asm for memory fence have been used for implementing a device driver on top of memory mapped I/O. Several examples can be found in Linux kernel. If we forget about the risk of uncaught exceptions (if any,) does it make sense to replace them with C++11 atomics? Or, is it possible at all? 回答1: In general, you can replace memory fences with atomics, but not volatile , except where it is used together with a fence exclusively for inter thread