]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/thread/test/test_5351.cpp
1 // Copyright (C) 2010 Vicente Botet
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)
6 #define BOOST_THREAD_PROVIDES_INTERRUPTIONS
9 #include <boost/thread/thread_only.hpp>
10 #include <boost/date_time/posix_time/posix_time_types.hpp>
11 #include <boost/thread/future.hpp>
13 using namespace boost::posix_time
;
14 using namespace boost
;
18 this_thread::sleep(seconds(10));
25 boost::packaged_task
<int> pt(&foo
);
26 boost::unique_future
<int> fi
= pt
.get_future();
27 boost::thread
task(boost::move(pt
)); // launch task on a thread
35 catch (boost::thread_interrupted
& exc
)
37 std::cout
<< "OK: " << std::endl
;
40 catch (boost::exception
& exc
)
42 std::cout
<< __LINE__
<< " ERROR: " << boost::diagnostic_information(exc
) << std::endl
;
47 std::cout
<< __LINE__
<< " ERROR: " << std::endl
;
50 std::cout
<< __LINE__
<< " ERROR: " << std::endl
;