Subj : Re: Can C++ local static objects be made thread safe? To : comp.programming.threads From : Alexander Terekhov Date : Tue Feb 15 2005 09:06 pm David Schwartz wrote: [...] > Another implementation does the magic in the page mapping. Each thread > gets the same address for the thread local variable, but a different page is > mapped into that address in each thread. That would preclude sharing and brake POSIX and C/C++ process/ program object model with shareable objects and unique per-object addresses (within a process). __thread storage duration is nothing but syntactical sugar for accesses via pthread_getspecific() with "statically intialized" keys and (GCC aside for a moment) object ctors and dtors thrown into the mix. The mappings (key/value bindings) can be held in per-thread "MMU state" (see POSIX Rationale), but associated objects must have unique addresses within a process and must be accessible from other threads. Otherwise it's totally brain-dead. regards, alexander. .