Subj : Re: Can C++ local static objects be made thread safe? To : comp.programming.threads From : Marcin 'Qrczak' Kowalczyk Date : Sat Feb 19 2005 11:59 pm gniccolai@yahoo.com (Giancarlo Niccolai) writes: > Sorry, but there's nothing in your test that resembles the class of > problem we are discussing here. No one wants to recursively initialize > nothing. If the initializer is never entered again while its previous execution hasn't finished yet, then operations on the guarding mutex are no-ops and thus obviously don't break anything. > If the compiler protects the ACT of the initialization, then it puts > at risk any DATA PROTECTION that the code may need to perform inside > the initialization (and I underline NEED). Please show a concrete code which may break because of the implicitly inserted mutex (i.e. which is correct when static locals have the semantics of traditional boolean guards without synchronization but is not correct with the implicit mutex or pthread_once). You don't listen to a proof that it can't break anything, so perhaps you will be convinced by the impossibility of constructing an example which would confirm your claim. Since you are arguing that *some* code can break, one correct example is enough. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/ .