Subj : Re: double-checked locking in C To : comp.programming.threads From : David Hopwood Date : Thu Jul 07 2005 05:21 pm Laurent Deniau wrote: > David Hopwood wrote: >> Laurent Deniau wrote: >> >>> The compiler is not allowed to assign initialized *before* >>> extern_init_code() returns. The processor will not be able to do the >>> same since this is a true jump with a return value. >> >> You're mistaken; processors can reorder memory accesses across jumps. > > I was abusively talking of a jump while in fact the goal was to have a > call. I don't know if processor can do tentative evaluation of a call, > but the value it has to assigned is returned by value from the call. You don't know how the compiler will implement the function call. Even if it uses processor instructions designed for the implementation of calls, however, it is still possible for reordering and speculative execution to occur across these instructions. -- David Hopwood .