
12 Mar
2009
12 Mar
'09
1:05 a.m.
Is the following code supposed to work (instead of resulting on a stack overflow)? If so, what I'm doing wrong? I'm using Boost 1.37.0 on MS Visual Studio 2008, Windows. #include <boost/thread/once.hpp> boost::once_flag initialization_flag = BOOST_ONCE_INIT; void call_me_once() { boost::call_once( initialization_flag, call_me_once ); } int main( int, char*[] ) { boost::call_once( initialization_flag, call_me_once ); return 0; } Additionaly, - Can a once_flag be safelly used in a class or local static? - Is BOOST_ONCE_INIT guaranteed to statically initialize the flag? Agustín K-ballo Bergé.-