update boost on linux
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// detail/select_reactor.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <boost/asio/detail/timer_queue_base.hpp>
|
||||
#include <boost/asio/detail/timer_queue_set.hpp>
|
||||
#include <boost/asio/detail/wait_op.hpp>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/execution_context.hpp>
|
||||
|
||||
#if defined(BOOST_ASIO_HAS_IOCP)
|
||||
# include <boost/asio/detail/thread.hpp>
|
||||
@@ -48,7 +48,7 @@ namespace asio {
|
||||
namespace detail {
|
||||
|
||||
class select_reactor
|
||||
: public boost::asio::detail::service_base<select_reactor>
|
||||
: public execution_context_service_base<select_reactor>
|
||||
{
|
||||
public:
|
||||
#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
|
||||
@@ -65,17 +65,17 @@ public:
|
||||
};
|
||||
|
||||
// Constructor.
|
||||
BOOST_ASIO_DECL select_reactor(boost::asio::io_service& io_service);
|
||||
BOOST_ASIO_DECL select_reactor(boost::asio::execution_context& ctx);
|
||||
|
||||
// Destructor.
|
||||
BOOST_ASIO_DECL ~select_reactor();
|
||||
|
||||
// Destroy all user-defined handler objects owned by the service.
|
||||
BOOST_ASIO_DECL void shutdown_service();
|
||||
BOOST_ASIO_DECL void shutdown();
|
||||
|
||||
// Recreate internal descriptors following a fork.
|
||||
BOOST_ASIO_DECL void fork_service(
|
||||
boost::asio::io_service::fork_event fork_ev);
|
||||
BOOST_ASIO_DECL void notify_fork(
|
||||
boost::asio::execution_context::fork_event fork_ev);
|
||||
|
||||
// Initialise the task, but only if the reactor is not in its own thread.
|
||||
BOOST_ASIO_DECL void init_task();
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
// Post a reactor operation for immediate completion.
|
||||
void post_immediate_completion(reactor_op* op, bool is_continuation)
|
||||
{
|
||||
io_service_.post_immediate_completion(op, is_continuation);
|
||||
scheduler_.post_immediate_completion(op, is_continuation);
|
||||
}
|
||||
|
||||
// Start a new operation. The reactor operation will be performed when the
|
||||
@@ -107,13 +107,20 @@ public:
|
||||
BOOST_ASIO_DECL void cancel_ops(socket_type descriptor, per_descriptor_data&);
|
||||
|
||||
// Cancel any operations that are running against the descriptor and remove
|
||||
// its registration from the reactor.
|
||||
// its registration from the reactor. The reactor resources associated with
|
||||
// the descriptor must be released by calling cleanup_descriptor_data.
|
||||
BOOST_ASIO_DECL void deregister_descriptor(socket_type descriptor,
|
||||
per_descriptor_data&, bool closing);
|
||||
|
||||
// Remote the descriptor's registration from the reactor.
|
||||
// Remove the descriptor's registration from the reactor. The reactor
|
||||
// resources associated with the descriptor must be released by calling
|
||||
// cleanup_descriptor_data.
|
||||
BOOST_ASIO_DECL void deregister_internal_descriptor(
|
||||
socket_type descriptor, per_descriptor_data& descriptor_data);
|
||||
socket_type descriptor, per_descriptor_data&);
|
||||
|
||||
// Perform any post-deregistration cleanup tasks associated with the
|
||||
// descriptor data.
|
||||
BOOST_ASIO_DECL void cleanup_descriptor_data(per_descriptor_data&);
|
||||
|
||||
// Move descriptor registration from one descriptor_data object to another.
|
||||
BOOST_ASIO_DECL void move_descriptor(socket_type descriptor,
|
||||
@@ -142,8 +149,14 @@ public:
|
||||
typename timer_queue<Time_Traits>::per_timer_data& timer,
|
||||
std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)());
|
||||
|
||||
// Move the timer operations associated with the given timer.
|
||||
template <typename Time_Traits>
|
||||
void move_timer(timer_queue<Time_Traits>& queue,
|
||||
typename timer_queue<Time_Traits>::per_timer_data& target,
|
||||
typename timer_queue<Time_Traits>::per_timer_data& source);
|
||||
|
||||
// Run select once until interrupted or events are ready to be dispatched.
|
||||
BOOST_ASIO_DECL void run(bool block, op_queue<operation>& ops);
|
||||
BOOST_ASIO_DECL void run(long usec, op_queue<operation>& ops);
|
||||
|
||||
// Interrupt the select loop.
|
||||
BOOST_ASIO_DECL void interrupt();
|
||||
@@ -152,9 +165,6 @@ private:
|
||||
#if defined(BOOST_ASIO_HAS_IOCP)
|
||||
// Run the select loop in the thread.
|
||||
BOOST_ASIO_DECL void run_thread();
|
||||
|
||||
// Entry point for the select loop thread.
|
||||
BOOST_ASIO_DECL static void call_run_thread(select_reactor* reactor);
|
||||
#endif // defined(BOOST_ASIO_HAS_IOCP)
|
||||
|
||||
// Helper function to add a new timer queue.
|
||||
@@ -164,15 +174,20 @@ private:
|
||||
BOOST_ASIO_DECL void do_remove_timer_queue(timer_queue_base& queue);
|
||||
|
||||
// Get the timeout value for the select call.
|
||||
BOOST_ASIO_DECL timeval* get_timeout(timeval& tv);
|
||||
BOOST_ASIO_DECL timeval* get_timeout(long usec, timeval& tv);
|
||||
|
||||
// Cancel all operations associated with the given descriptor. This function
|
||||
// does not acquire the select_reactor's mutex.
|
||||
BOOST_ASIO_DECL void cancel_ops_unlocked(socket_type descriptor,
|
||||
const boost::system::error_code& ec);
|
||||
|
||||
// The io_service implementation used to post completions.
|
||||
io_service_impl& io_service_;
|
||||
// The scheduler implementation used to post completions.
|
||||
# if defined(BOOST_ASIO_HAS_IOCP)
|
||||
typedef class win_iocp_io_context scheduler_type;
|
||||
# else // defined(BOOST_ASIO_HAS_IOCP)
|
||||
typedef class scheduler scheduler_type;
|
||||
# endif // defined(BOOST_ASIO_HAS_IOCP)
|
||||
scheduler_type& scheduler_;
|
||||
|
||||
// Mutex to protect access to internal data.
|
||||
boost::asio::detail::mutex mutex_;
|
||||
@@ -190,6 +205,10 @@ private:
|
||||
timer_queue_set timer_queues_;
|
||||
|
||||
#if defined(BOOST_ASIO_HAS_IOCP)
|
||||
// Helper class to run the reactor loop in a thread.
|
||||
class thread_function;
|
||||
friend class thread_function;
|
||||
|
||||
// Does the reactor loop thread need to stop.
|
||||
bool stop_thread_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user