Subj : Re: Can C++ local static objects be made thread safe? To : comp.programming.threads From : Alexander Terekhov Date : Wed Feb 16 2005 02:41 pm David Schwartz wrote: > > "Alexander Terekhov" wrote in message > news:42132E79.BB79F8C6@web.de... > > > David Schwartz wrote: > > >> There will always have to be restrictions on passing the address of > >> thread-local variables between threads because the implementation manages > >> their lifetime. What those restrictions are can certainly vary, > > > Objects with __thread storage duration are no more "thread-private" > > than objects with automatic storage duration (auto stuff). > > What standard requires this? The International Common Sense Std. Unwritten. > > > IOW, they > > are NOT thread-private. Doing it otherwise is utterly brain-dead. > > You have said this, but not explained why. Threads != processes (not even "enclaves" in IBM LE terms). > > It should be obvious that for the vast majority of cases, what you are > claiming is required is not required. As-if rule, you know. > Further, in most cases, it results in > dramatically reduced performance. Really? Can you back this claim up with facts? > > http://docs.biostat.wustl.edu/cgi-bin/info2html?(gcc.info.gz)C99%2520Thread-Local%2520Edits Uhmm, they still strive for brain-dead non-lazy semantics. > > Notice no mention of share memory in the definition of threads. Notice > no discussion of the semantics of taking the address of a thread-local > variable. So what? It doesn't say that taking the address is undefined or that threads can't access objects with thread storage duration "owned" by other threads. The only sensible conclusion is that "normal rules" of the C{/POSIX} object model are perfectly applicable and portable programs can rely on them for objects with thread storage duration as well. regards, alexander. .