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

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