
2 Aug
2005
2 Aug
'05
7:32 p.m.
Jonathan Turkanis wrote:
Jason Hise wrote:
So to avoid the whole mess regarding the DCLP, the best approach would probably be eager initialization, before the program enters a multi-threaded context. Is initializing from the constructor of a namespace-scope global enough to ensure this?
I don't think so, since you might want to access singletons from static initializers in other translation units.
Have you considered using call_once: http://www.boost.org/doc/html/call_once.html?
Why does it require that the function which is called once not be allowed to throw? I am not sure that I can meet this requirement, as I may need to dynamically allocate memory. -Jason