]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/thread/example/user_scheduler.cpp
1 // Copyright (C) 2013 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 #include <boost/config.hpp>
8 #define BOOST_THREAD_VERSION 5
9 //#define BOOST_THREAD_USES_LOG
10 #define BOOST_THREAD_USES_LOG_THREAD_ID
11 #if ! defined BOOST_NO_CXX11_DECLTYPE
12 #define BOOST_RESULT_OF_USE_DECLTYPE
14 #include <boost/thread/detail/log.hpp>
15 #include <boost/thread/executors/loop_executor.hpp>
16 #include <boost/assert.hpp>
17 #include <boost/thread/thread_only.hpp>
21 #pragma warning(disable: 4127) // conditional expression is constant
27 << boost::this_thread::get_id() << " P1" << BOOST_THREAD_END_LOG
;
33 << boost::this_thread::get_id() << " P2" << BOOST_THREAD_END_LOG
;
36 void submit_some(boost::loop_executor
& tp
) {
52 << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG
;
56 boost::loop_executor tp
;
58 tp
.run_queued_closures();
60 tp
.run_queued_closures();
62 catch (std::exception
& ex
)
65 << "ERRORRRRR " << ex
.what() << "" << BOOST_THREAD_END_LOG
;
71 << " ERRORRRRR exception thrown" << BOOST_THREAD_END_LOG
;
77 << boost::this_thread::get_id() << "MAIN>" << BOOST_THREAD_END_LOG
;