[Patch, toplevel/config] fix tls.m4 configure race condition (bootstrap/PR43170)
Ralf Wildenhues
Ralf.Wildenhues@gmx.de
Tue Jun 8 19:07:00 GMT 2010
* Jakub Jelinek wrote on Tue, Jun 08, 2010 at 08:50:58PM CEST:
> On Tue, Jun 08, 2010 at 08:27:55PM +0200, Ralf Wildenhues wrote:
> > So, when we are admitting to the use of volatile as a hack to tame the
> > optimizer beast, let's turn the question around: does __thread have any
> > guaranteed observable semantics that we can test instead? I.e.,
> > something that doesn't need revisiting with the great optimizing
> > features of next year's GCC?
>
> The property is that addresses of the __thread variable in different
> concurrent threads are different (or, in other way, modifying the __thread
> var in one thread won't modify it in the other thread).
So, a test that modifies the __thread variable in one thread, gives up a
mutex, then the other thread grabs it, and looks whether its copy of the
variable was updated should work without volatile, and regardless of the
power of your optimizer, and has the additional property of relying only
on semantics guaranteed by standards. Right?
Thanks,
Ralf
More information about the Gcc-patches
mailing list