// Copyright (C) 2009 Vicente J. Botet Escriba // // 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 static bool mycallable1_called =false; static bool mycallable2_called =false; struct mycallable1 { void operator()() const { mycallable1_called=true; std::cout << "mycallable1" << std::endl; }; }; struct mycallable2 { void operator()() const { mycallable2_called=true; std::cout << "mycallable2" << std::endl; //BOOST_CHECK(false && "mycallable2 has been called"); }; }; void my_thread() { mycallable1 x; boost::this_thread::at_thread_exit(x); } void test_ticket_2739() { mycallable2 x; boost::this_thread::at_thread_exit(x); boost::thread th(my_thread); th.join(); BOOST_CHECK(mycallable1_called); } boost::unit_test_framework::test_suite* init_unit_test_suite(int, char*[]) { boost::unit_test_framework::test_suite* test = BOOST_TEST_SUITE("Boost.Threads: ticket 2739"); test->add(BOOST_TEST_CASE(test_ticket_2739)); return test; }