id summary reporter owner description type status milestone component version severity resolution keywords cc 3407 boost::call_once not re-entrant (at least in win32) Vincent Falco Anthony Williams "The win32 implementation of boost::call_once ( boost/thread/win32/once.hpp version 1.40.0 ) is not reentrant for the same thread. The problem happens on line 127. The function is called, and then the flag is set. This order should be reversed, the flag should be set and then the function should be called. If the function throws, the flag must be set back. This program demonstrates the issue: #include static boost::once_flag flag; void called_twice() { boost::call_once( called_twice, flag ); // gets here twice } int main() { boost::call_once( called_twice, flag ); } While this may seem like a contrived example, it can easily happen in practice. Consider the case of a boost::singleton constructor that calls a function which then accesses its 'instance' member. The result will be that the singleton is created twice, because call_once is not re-entrant. Also consider the case of two singletons, A and B. A calls methods on B from its constructor, and B calls methods on A from its constructor. A will be created twice due to the non-reentrant behavior of call_once. I have not studied the behavior of call_once for other platforms. " Bugs closed Boost 1.41.0 thread Boost 1.40.0 Problem wontfix threads