diff options
Diffstat (limited to '3rdParty/Boost/src/boost/asio/detail/select_reactor.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/asio/detail/select_reactor.hpp | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/3rdParty/Boost/src/boost/asio/detail/select_reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/select_reactor.hpp index f4f8bdf..a434546 100644 --- a/3rdParty/Boost/src/boost/asio/detail/select_reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/select_reactor.hpp @@ -2,7 +2,7 @@ // detail/select_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -22,7 +22,9 @@ && !defined(BOOST_ASIO_HAS_EPOLL) \ && !defined(BOOST_ASIO_HAS_KQUEUE)) +#include <boost/limits.hpp> #include <cstddef> +#include <boost/asio/detail/fd_set_adapter.hpp> #include <boost/asio/detail/mutex.hpp> #include <boost/asio/detail/op_queue.hpp> #include <boost/asio/detail/reactor_op.hpp> @@ -30,10 +32,10 @@ #include <boost/asio/detail/select_interrupter.hpp> #include <boost/asio/detail/select_reactor_fwd.hpp> #include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/detail/timer_op.hpp> #include <boost/asio/detail/timer_queue_base.hpp> #include <boost/asio/detail/timer_queue_fwd.hpp> #include <boost/asio/detail/timer_queue_set.hpp> +#include <boost/asio/detail/wait_op.hpp> #include <boost/asio/io_service.hpp> #if defined(BOOST_ASIO_HAS_IOCP) @@ -72,6 +74,10 @@ public: // Destroy all user-defined handler objects owned by the service. BOOST_ASIO_DECL void shutdown_service(); + // Recreate internal descriptors following a fork. + BOOST_ASIO_DECL void fork_service( + boost::asio::io_service::fork_event fork_ev); + // Initialise the task, but only if the reactor is not in its own thread. BOOST_ASIO_DECL void init_task(); @@ -79,6 +85,12 @@ public: // code on failure. BOOST_ASIO_DECL int register_descriptor(socket_type, per_descriptor_data&); + // Register a descriptor with an associated single operation. Returns 0 on + // success, system error code on failure. + BOOST_ASIO_DECL int register_internal_descriptor( + int op_type, socket_type descriptor, + per_descriptor_data& descriptor_data, reactor_op* op); + // Post a reactor operation for immediate completion. void post_immediate_completion(reactor_op* op) { @@ -97,8 +109,17 @@ public: // Cancel any operations that are running against the descriptor and remove // its registration from the reactor. - BOOST_ASIO_DECL void close_descriptor(socket_type descriptor, - per_descriptor_data&); + BOOST_ASIO_DECL void deregister_descriptor(socket_type descriptor, + per_descriptor_data&, bool closing); + + // Remote the descriptor's registration from the reactor. + BOOST_ASIO_DECL void deregister_internal_descriptor( + socket_type descriptor, per_descriptor_data& descriptor_data); + + // Move descriptor registration from one descriptor_data object to another. + BOOST_ASIO_DECL void move_descriptor(socket_type descriptor, + per_descriptor_data& target_descriptor_data, + per_descriptor_data& source_descriptor_data); // Add a new timer queue to the reactor. template <typename Time_Traits> @@ -113,13 +134,14 @@ public: template <typename Time_Traits> void schedule_timer(timer_queue<Time_Traits>& queue, const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op); + typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op); // Cancel the timer operations associated with the given token. Returns the // number of operations that have been posted or dispatched. template <typename Time_Traits> std::size_t cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer); + typename timer_queue<Time_Traits>::per_timer_data& timer, + std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)()); // Run select once until interrupted or events are ready to be dispatched. BOOST_ASIO_DECL void run(bool block, op_queue<operation>& ops); @@ -162,6 +184,9 @@ private: // The queues of read, write and except operations. reactor_op_queue<socket_type> op_queue_[max_ops]; + // The file descriptor sets to be passed to the select system call. + fd_set_adapter fd_sets_[max_select_ops]; + // The timer queues. timer_queue_set timer_queues_; |