1 | // Copyright (C) 2009 Vicente J. Botet Escriba
|
---|
2 | //
|
---|
3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying
|
---|
4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
---|
5 | #include <boost/thread/thread.hpp>
|
---|
6 | #include <boost/test/unit_test.hpp>
|
---|
7 |
|
---|
8 | static bool mycallable1_called =false;
|
---|
9 |
|
---|
10 | struct mycallable1
|
---|
11 | {
|
---|
12 | void operator()() {
|
---|
13 | mycallable1_called=true;
|
---|
14 | };
|
---|
15 | };
|
---|
16 |
|
---|
17 | void my_thread() {
|
---|
18 | mycallable1 x;
|
---|
19 | boost::this_thread::at_thread_exit(x);
|
---|
20 | }
|
---|
21 |
|
---|
22 | void test_ticket_2742()
|
---|
23 | {
|
---|
24 | boost::thread th(my_thread);
|
---|
25 | th.join();
|
---|
26 | BOOST_CHECK(mycallable1_called);
|
---|
27 | }
|
---|
28 |
|
---|
29 | boost::unit_test_framework::test_suite* init_unit_test_suite(int, char*[])
|
---|
30 | {
|
---|
31 | boost::unit_test_framework::test_suite* test =
|
---|
32 | BOOST_TEST_SUITE("Boost.Threads: ticket 2742");
|
---|
33 |
|
---|
34 | test->add(BOOST_TEST_CASE(test_ticket_2742));
|
---|
35 | return test;
|
---|
36 | }
|
---|