Subj : Re: double-checked locking in C To : comp.programming.threads From : David Schwartz Date : Wed Jul 06 2005 11:56 pm "Laurent Deniau" wrote in message news:42CC493F.4020705@cern.ch... > Now, there is the problem of reflecting the change of the side effects to > other threads. My suggestion was to put the flag inside the side object > itself. Therefore if the init_value is seen, the object is also seen. Of > course you may think that the object takes place on cache line boundary > and is only partially updated. That is in the worst case, only the flag > part and not the rest. But I am not sure if this can happen. You just don't get it. We're talking about *PORTABLE* code written for an abstract machine. There is no such thing as a cache line. You have the guarantees the standards give you. And that's it. If you claim anything else is guaranteed, then you have code that's *not* portable. You said: >There is a simple, portable, processor independent, compiler independent >idiom which consists of delegating the work to an extern function, a >function with an implementation in a different translation unit. And then you went and talked about different types of caches! Portable processor independent compiled independent code cannot be dependent on what caches do. DS .