Subj : Re: Boost.Threads on its way to C++0x To : comp.programming.threads From : gottlobfrege Date : Thu Apr 28 2005 10:54 pm Ben Hutchings wrote: > Peter Dimov wrote: > > gottlobfrege@gmail.com wrote: > >> - a static_local template: > >> > >> int func() > >> { > >> // this thread-safely inits foo only once > >> static static_local foo(foo_param1, foo_param2,...); > > > > How do you solve the race condition WRT the hidden compiler-generated > > boolean flag? > > You fix it in at the language level. Hans Boehm reported that > "[t]here appeared to be consensus among those attending the last C++ > standards meeting that both [synchronised and unsychronised] options > should be provided to the programmer" > . > > -- > Ben Hutchings > Horngren's Observation: > Among economists, the real world is often a special case. Yes, it should definitely be optional - you don't want the overhead for all the cases where you know it is not needed. One of C++'s mantras I believe... .