On 19/03/2015 10:33, Dr. David Alan Gilbert wrote: >> > But still pointless. Atomicity isn't magic pixie dust; it only makes >> > sense if you're making atomic specific operations that need to be. >> > Simple integer loads and stores are already atomic. Unless at least >> > some of the atomic operations are something more complex, there's >> > really no point to atomically marked operations. > OK, I'll kill it off.
No, don't. And both of you, read docs/atomics.txt. "atomic_read() and atomic_set() prevents the compiler from using optimizations that might otherwise optimize accesses out of existence on the one hand, or that might create unsolicited accesses on the other. [...] it tells readers which variables are shared with other threads, and which are local to the current thread or protected by other, more mundane means." atomic_read() and atomic_set() provide the same guarantees as ACCESS_ONCE in the Linux kernel. Paolo