
8 Dec
2011
8 Dec
'11
4:04 p.m.
I have noticed that for Windows, atomic_write32 is defined thus: inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val) { winapi::interlocked_exchange(reinterpret_cast<volatile long*>(mem), val); } Whereas otherwise like this: inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val) { *mem = val; } the reads are both: return *mem; Windows documentation states that: 'Simple reads and writes to properly-aligned 32-bit variables are atomic operations.' [http://msdn.microsoft.com/en-us/library/windows/desktop/ms684122%28v=vs.85%2...] Is there a reason for this? Thanks, Peter