Subj : Re: Can C++ local static objects be made thread safe? To : comp.programming.threads From : Marcin 'Qrczak' Kowalczyk Date : Wed Jan 19 2005 12:48 am Olivier Huet writes: > Here are some arguments for "not" locking : C++ itself doesn't include > any multithreading features, so why should the compiler include a lock > here ? IMHO if the compiler supports threads, it should act as if it implemented a hypothetical extended C++ standard with threads. A reasonable semantics of static variables in functions in multithreaded C++ would require locking. > And if it does, what kind of lock : process wide (for multiple > threads that access the variable), system wide (for multiple process > that access the variable), etc etc. ? Depending on whether the variable is process wide or system wide. Generally I tend to associate implicit locks with global objects (singletons) and explicit locks with local, "anonymous" objects. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/ .