// (C) Copyright 2006-7 Anthony Williams // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include #include #include #include #define LOG \ if (false) {} else std::cout << std::endl << __FILE__ << "[" << __LINE__ << "]" boost::once_flag flag=BOOST_ONCE_INIT; int var_to_init=0; boost::mutex m; void initialize_variable() { // ensure that if multiple threads get in here, they are serialized, so we can see the effect boost::mutex::scoped_lock lock(m); ++var_to_init; } void call_once_thread() { unsigned const loop_count=100; int my_once_value=0; for(unsigned i=0;iadd(BOOST_TEST_CASE(test_call_once)); test->add(BOOST_TEST_CASE(test_call_once_arbitrary_functor)); test->add(BOOST_TEST_CASE(test_call_once_retried_on_exception)); return test; } void remove_unused_warning() { //../../../boost/test/results_collector.hpp:40:13: warning: unused function 'first_failed_assertion' [-Wunused-function] //(void)first_failed_assertion; //../../../boost/test/tools/floating_point_comparison.hpp:304:25: warning: unused variable 'check_is_close' [-Wunused-variable] //../../../boost/test/tools/floating_point_comparison.hpp:326:25: warning: unused variable 'check_is_small' [-Wunused-variable] (void)boost::test_tools::check_is_close; (void)boost::test_tools::check_is_small; }