Subj : Re: Can C++ local static objects be made thread safe? To : comp.programming.threads From : Gianni Mariani Date : Thu Feb 03 2005 06:58 am David Schwartz wrote: > "Gianni Mariani" wrote in message > news:haGdnR1nYeaWBJzfRVn-tg@speakeasy.net... > > >>Simply because the C++ standard is quite specific in that static function >>local variables (non POD) must be initialized exactly once on the *first >>time* that control passes through the variable. All we're doing here is >>enforcing this requirement. > > > No! The C++ standard says nothing about threads. The C++ standard does > not provide *any* guarantees in the context of threads.' Exactly. Hence, any platform that supports threads must do so in a way that it maintains the requirements of the C++ standard, otherwise it is BROKEN. A threading standard > must specifically restate any C++ standard guarantees that it provides in > the context of threads. If we're talking POSIX, POSIX specifically requires > accesses to shared data (which the static object is) to be protected by > mutexes. Only if the shared data is modified. .