Subj : Re: Can C++ local static objects be made thread safe? To : comp.programming.threads From : Marcin 'Qrczak' Kowalczyk Date : Wed Jan 19 2005 01:37 am Olivier Huet writes: >> Depending on whether the variable is process wide or system wide. > > Yes, but generally, the compiler itself doesn't know it : in a lot of > couples compiler+OS, variables are done "system wide" with some OS > calls : shared memory, memory file mapping etc. On Unix a static variable in a function cannot be system wide. You can obtain shared memory or mmap region first, and then put objects at the address you got. This can't apply to static variables whose address is predetermined by the compiler. I think on Windows you can choose whether a DLL will have its memory shared between processes or not. Determining the kind of lock should be delayed until the scope of the DLL is determined. I don't know if this is implementable. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/ .