On Mon, 2007-10-29 at 10:37 +0100, Samuel Tardieu wrote:
> >>>>> "skaller" == skaller  <[EMAIL PROTECTED]> writes:

> with (x86):
> 
>         movl    a, %eax
>         cmpl    $1, 4(%esp)
>         sbbl    $-1, %eax
>         movl    %eax, a
> 
> There is clearly a race condition if you have multiple threads
> executing this code even if only one thread has "locked" being true.

Ah .. ok I think I finally see. Thanks! The code ensures
well definedness by checking the establishment of the
required invariant and dynamically chosing whether or not
to do the access on that basis .. and the optimisation
above defeats that by lifting the access out of the
conditional.

In the single threaded case the lift works because it
relies on sequential access, which is the only possibility
for a single thread.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

Reply via email to