Subj : Re: double-checked locking in C To : comp.programming.threads From : David Schwartz Date : Wed Jul 06 2005 11:19 am "Laurent Deniau" wrote in message news:dagnq8$dgi$1@sunnews.cern.ch... > How I can I prove that there is no bogus? If the DCL code shown is so easy > to break, show me a sequence of actions (points). I can detail all steps > for different cases, but it will be much longer than showing a single > bogus case, if any. I already showed you the sequence. A later thread sees 'initialized' as 'true' but does not see the values that *were* initialized. The problem you are trying to solve is fundamental. It goes like this: 1) The whole point of DCL is that subsequent threads don't have to acquire any locks and still must see the effects of the initialization. 2) Nothing in the DCL patterns presented actually ensures that subsequent threads see the effects of the initialization. Therefore subsequent threads might not see the effects of the initialization. The fundamental error is thinking that mutexes do something even for threads that do not acquire them. A mutex is only guaranteed to work if it is accessed by a thread that holds the same mutex that was held by the thread that changed the value. DS .