On 26 October 2007 23:46, David Miller wrote: > From: "Dave Korn" > Date: Fri, 26 Oct 2007 17:35:44 +0100 > >> On 26 October 2007 17:28, Andrew Haley wrote: >> >>> Richard Guenther writes: >>> > > >>> > > This is legal POSIX threads code: counter is not accessed when we do >>> > > not hold the mutex. According to POSIX we do not have to declare >>> > > volatile memory that we only access when we hold a mutex. > >>> > I hope we're not trying to support such w/o volatile counter. >>> >>> I think we have to: not just for POSIX, but for the Linux kernel too. >>> >>> > Whatever POSIX says, this would pessimize generic code too much. >>> >>> We don't have to do it for non-threaded code. >> >> I certainly won't object to any move to prohibit the >> read-conditional-add-write (and related) optimisation(s) when compiling >> with an option that explicitly specifies that we are compiling >> multi-threaded code. > > What about signals?
Heh, you got me there. What about signals? > Those are just another asynchronous context with similar issues. Sure. Lump it all in with threaded in the above statement. > Please don't point me at standards documents in your response, > that is not what truly matters here. Let me generalise the above statement: >> I certainly won't object to any move to prohibit ... any optimisations whatsoever, including but not limited to ... >> read-conditional-add-write (and related) optimisation(s) when compiling >> with an option that explicitly specifies that we are compiling ... any kind of asynchronous or ... >> multi-threaded code. cheers, DaveK -- Can't think of a witty .sigline today....