annotate DEPENDENCIES/generic/include/boost/asio/detail/impl/select_reactor.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 //
Chris@16 2 // detail/impl/select_reactor.hpp
Chris@16 3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chris@16 4 //
Chris@101 5 // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
Chris@16 6 //
Chris@16 7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 9 //
Chris@16 10
Chris@16 11 #ifndef BOOST_ASIO_DETAIL_IMPL_SELECT_REACTOR_HPP
Chris@16 12 #define BOOST_ASIO_DETAIL_IMPL_SELECT_REACTOR_HPP
Chris@16 13
Chris@16 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
Chris@16 15 # pragma once
Chris@16 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
Chris@16 17
Chris@16 18 #include <boost/asio/detail/config.hpp>
Chris@16 19
Chris@16 20 #if defined(BOOST_ASIO_HAS_IOCP) \
Chris@16 21 || (!defined(BOOST_ASIO_HAS_DEV_POLL) \
Chris@16 22 && !defined(BOOST_ASIO_HAS_EPOLL) \
Chris@16 23 && !defined(BOOST_ASIO_HAS_KQUEUE) \
Chris@16 24 && !defined(BOOST_ASIO_WINDOWS_RUNTIME))
Chris@16 25
Chris@16 26 #include <boost/asio/detail/push_options.hpp>
Chris@16 27
Chris@16 28 namespace boost {
Chris@16 29 namespace asio {
Chris@16 30 namespace detail {
Chris@16 31
Chris@16 32 template <typename Time_Traits>
Chris@16 33 void select_reactor::add_timer_queue(timer_queue<Time_Traits>& queue)
Chris@16 34 {
Chris@16 35 do_add_timer_queue(queue);
Chris@16 36 }
Chris@16 37
Chris@16 38 // Remove a timer queue from the reactor.
Chris@16 39 template <typename Time_Traits>
Chris@16 40 void select_reactor::remove_timer_queue(timer_queue<Time_Traits>& queue)
Chris@16 41 {
Chris@16 42 do_remove_timer_queue(queue);
Chris@16 43 }
Chris@16 44
Chris@16 45 template <typename Time_Traits>
Chris@16 46 void select_reactor::schedule_timer(timer_queue<Time_Traits>& queue,
Chris@16 47 const typename Time_Traits::time_type& time,
Chris@16 48 typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op)
Chris@16 49 {
Chris@16 50 boost::asio::detail::mutex::scoped_lock lock(mutex_);
Chris@16 51
Chris@16 52 if (shutdown_)
Chris@16 53 {
Chris@16 54 io_service_.post_immediate_completion(op, false);
Chris@16 55 return;
Chris@16 56 }
Chris@16 57
Chris@16 58 bool earliest = queue.enqueue_timer(time, timer, op);
Chris@16 59 io_service_.work_started();
Chris@16 60 if (earliest)
Chris@16 61 interrupter_.interrupt();
Chris@16 62 }
Chris@16 63
Chris@16 64 template <typename Time_Traits>
Chris@16 65 std::size_t select_reactor::cancel_timer(timer_queue<Time_Traits>& queue,
Chris@16 66 typename timer_queue<Time_Traits>::per_timer_data& timer,
Chris@16 67 std::size_t max_cancelled)
Chris@16 68 {
Chris@16 69 boost::asio::detail::mutex::scoped_lock lock(mutex_);
Chris@16 70 op_queue<operation> ops;
Chris@16 71 std::size_t n = queue.cancel_timer(timer, ops, max_cancelled);
Chris@16 72 lock.unlock();
Chris@16 73 io_service_.post_deferred_completions(ops);
Chris@16 74 return n;
Chris@16 75 }
Chris@16 76
Chris@16 77 } // namespace detail
Chris@16 78 } // namespace asio
Chris@16 79 } // namespace boost
Chris@16 80
Chris@16 81 #include <boost/asio/detail/pop_options.hpp>
Chris@16 82
Chris@16 83 #endif // defined(BOOST_ASIO_HAS_IOCP)
Chris@16 84 // || (!defined(BOOST_ASIO_HAS_DEV_POLL)
Chris@16 85 // && !defined(BOOST_ASIO_HAS_EPOLL)
Chris@16 86 // && !defined(BOOST_ASIO_HAS_KQUEUE)
Chris@16 87 // && !defined(BOOST_ASIO_WINDOWS_RUNTIME))
Chris@16 88
Chris@16 89 #endif // BOOST_ASIO_DETAIL_IMPL_SELECT_REACTOR_HPP