1// Copyright (C) 2009 Anthony Williams
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
6#define BOOST_THREAD_USES_MOVE
7
8#define BOOST_TEST_MODULE Boost.Threads: thread return local test suite
9
10#include <boost/thread/thread_only.hpp>
11#include <boost/test/unit_test.hpp>
12
13void do_nothing(boost::thread::id* my_id)
14{
15 *my_id=boost::this_thread::get_id();
16}
17
18boost::thread make_thread_return_local(boost::thread::id* the_id)
19{
20 boost::thread t(do_nothing,the_id);
21 return boost::move(t);
22}
23
24BOOST_AUTO_TEST_CASE(test_move_from_function_return_local)
25{
26 boost::thread::id the_id;
27 boost::thread x=make_thread_return_local(the_id: &the_id);
28 boost::thread::id x_id=x.get_id();
29 x.join();
30 BOOST_CHECK_EQUAL(the_id,x_id);
31}
32

source code of boost/libs/thread/test/test_thread_return_local.cpp