Subj : Re: Can C++ local static objects be made thread safe? To : comp.programming.threads From : gottlobfrege Date : Thu Feb 17 2005 12:05 pm Marcin 'Qrczak' Kowalczyk wrote: > gniccolai@yahoo.com (Giancarlo Niccolai) writes: > > > That's not following the pthread_once semantic: all the threads get > > there even if once stuff is still NOT done. > > This is not true at least on Linux/NPTL: other threads calling > pthread_once do wait for the first thread to finish. > > The documentation is not clear enough to judge. > Although I wouldn't call the docs 'clear' either, I think we can deduce that the other threads must wait: from http://www.opengroup.org/onlinepubs/007908799/xsh/pthread_once.html (first google result for pthread_once): "On return from pthread_once(), it is guaranteed that init_routine() has completed." (And of course it says init_routine() is only called once.) Thus secondary threads must wait for the first thread to finish. Tony .