On 13 Oct 2010, at 15:27, Jonas Maebe wrote:

1) on entry of the "critical section" protected by this variable, you can have problems, because this sequence:

locked:=true;
local:=shared_global_var;

Of course, you normally need an atomic operation here to set "locked" to true (otherwise multiple threads can set it true at the same time), which is presumably why the x86 performs this kind of reordering (it will not reorder past atomic loads/stores). And you don't need an atomic operation to unlock, which is why it presumably does not perform any reordering in that situation.


Jonas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to