Le 15/11/2012 15:22, Sean Kelly a écrit :
On Nov 15, 2012, at 3:05 PM, David Nadlinger<s...@klickverbot.at>  wrote:

On Thursday, 15 November 2012 at 22:57:54 UTC, Andrei Alexandrescu wrote:
On 11/15/12 1:29 PM, David Nadlinger wrote:
On Wednesday, 14 November 2012 at 17:54:16 UTC, Andrei Alexandrescu wrote:
That is correct. My point is that compiler implementers would follow
some specification. That specification would contain informationt hat
atomicLoad and atomicStore must have special properties that put them
apart from any other functions.

What are these special properties? Sorry, it seems like we are talking
past each other…

For example you can't hoist a memory operation before a shared load or after a 
shared store.

Well, to be picky, that depends on what kind of memory operation you mean – 
moving non-volatile loads/stores across volatile ones is typically considered 
acceptable.

Usually not, really.  Like if you implement a mutex, you don't want 
non-volatile operations to be hoisted above the mutex acquire or sunk below the 
mutex release.  However, it's safe to move additional operations into the block 
where the mutex is held.

If it is known that the memory read/write is thread local, this is safe, even in the case of a mutex.

Reply via email to