%threads.entities; ]>
The call_once function and once_flag type (statically initialized to BOOST_ONCE_INIT) can be used to run a routine exactly once. This can be used to initialize data in a thread-safe manner. The implementation-defined macro BOOST_ONCE_INIT is a constant value used to initialize once_flag instances to indicate that the logically associated routine has not been run yet. See call_once for more details. The call_once function and once_flag type (statically initialized to BOOST_ONCE_INIT) can be used to run a routine exactly once. This can be used to initialize data in a thread-safe manner. The implementation-defined type once_flag is used as a flag to insure a routine is called only once. Instances of this type should be statically initialized to BOOST_ONCE_INIT. See call_once for more details. implementation-defined The call_once function and once_flag type (statically initialized to BOOST_ONCE_INIT) can be used to run a routine exactly once. This can be used to initialize data in a thread-safe manner. Example usage is as follows: //Example usage: boost::once_flag once = BOOST_ONCE_INIT; void init() { //... } void thread_proc() { boost::call_once(&init, once); } void (*func)() once_flag& The function func shall not throw exceptions. As if (in an atomic fashion): if (flag == BOOST_ONCE_INIT) func(); flag != BOOST_ONCE_INIT