Optimization of conditional access to globals: thread-unsafe?

Mark Mielke mark@mark.mielke.cc
Mon Oct 29 04:35:00 GMT 2007


Dave Korn wrote:
> On 29 October 2007 01:38, David Miller wrote:
>
>   
>   You'll be back.  Next week, you'll discover a corner case where caching a
> shared variable in a register can be a bad thing when one thread uses locks
> and the other doesn't, and you'll be back to demand that optimisation is
> removed as well.
>   
Why would David ask for something so unreasonable?

Why do you believe that the use of mutex to synchronize access to a 
shared resource, without the use of volatile on the shared resource 
being accessed, as documented in countless real life examples, is 
unreasonable or incorrect?

I do not understand your position.

Cheers,
mark

-- 
Mark Mielke <mark@mielke.cc>



More information about the Gcc mailing list