Subj : Re: Can C++ local static objects be made thread safe? To : comp.programming.threads From : Alexander Terekhov Date : Tue Feb 15 2005 11:24 am Gianni Mariani wrote: [...] > having to aquire the mutex. By using __thread (or thread specific data) > each thread aquires the mutex exactly once which is slightly less > efficient than a theoretically optimal DCL, but since that's not ^^^^^^^^^^^^^^^^^^^^^^^^^ That's DCSI-MBR (with variations based on semas) and DCSI-TLS/TSD. Anything else is neither optimal nor correct. > practical on modern CPU's, that point is moot. Suffice to say, this is > not an issue on any commercially available Pentium, Opteron or Athlon, > which kind of covers all CPU's most people care about. Yeah, apart from dual Macs and other Power stuff. And don't forget that compilers also reorder. In the case of overly constrained hardware, "per-thread" synchronization is needed to preclude "bad things" on *compiler's* part (hardware aside for a moment). [...] > describe here. Each thread has different memory mapped to the same > address (don't try to take the address of an __thread variable though). Why so? regards, alexander. .