On Mon, May 7, 2012 at 9:31 AM, John Harrison <harr...@tigermail.auburn.edu> wrote: > And you can guarantee that access to foo are atomic. Really, most CPU's can > load up to a double word in a single instruction, sometimes more. But for > complex data structures they may have to break down the load into multiple > operations and thats when atomic is important. Anyway, volatile is a > different use case.
Atomic operations will also emit any synchronization instructions necessary to ensure that the operation is observed outside of the CPU with the ordering specified by the atomic operation. The optimization barrier provided by volatile alone isn't enough to enable MMIO on modern architectures; the CPU and cache controller are still free to reorder or eliminate loads and stores treated as volatile by the compiler. -Joe _______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev