Realistic 3D camera system
3D camera system components
select_reactor.hpp
Go to the documentation of this file.
1 //
2 // detail/impl/select_reactor.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 //
10 
11 #ifndef ASIO_DETAIL_IMPL_SELECT_REACTOR_HPP
12 #define ASIO_DETAIL_IMPL_SELECT_REACTOR_HPP
13 
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 
18 #include "asio/detail/config.hpp"
19 
20 #if defined(ASIO_HAS_IOCP) \
21  || (!defined(ASIO_HAS_DEV_POLL) \
22  && !defined(ASIO_HAS_EPOLL) \
23  && !defined(ASIO_HAS_KQUEUE) \
24  && !defined(ASIO_WINDOWS_RUNTIME))
25 
27 
28 namespace asio {
29 namespace detail {
30 
31 template <typename Time_Traits>
33 {
34  do_add_timer_queue(queue);
35 }
36 
37 // Remove a timer queue from the reactor.
38 template <typename Time_Traits>
40 {
41  do_remove_timer_queue(queue);
42 }
43 
44 template <typename Time_Traits>
46  const typename Time_Traits::time_type& time,
48 {
50 
51  if (shutdown_)
52  {
53  io_service_.post_immediate_completion(op, false);
54  return;
55  }
56 
57  bool earliest = queue.enqueue_timer(time, timer, op);
58  io_service_.work_started();
59  if (earliest)
60  interrupter_.interrupt();
61 }
62 
63 template <typename Time_Traits>
66  std::size_t max_cancelled)
67 {
70  std::size_t n = queue.cancel_timer(timer, ops, max_cancelled);
71  lock.unlock();
72  io_service_.post_deferred_completions(ops);
73  return n;
74 }
75 
76 } // namespace detail
77 } // namespace asio
78 
80 
81 #endif // defined(ASIO_HAS_IOCP)
82  // || (!defined(ASIO_HAS_DEV_POLL)
83  // && !defined(ASIO_HAS_EPOLL)
84  // && !defined(ASIO_HAS_KQUEUE)
85  // && !defined(ASIO_WINDOWS_RUNTIME))
86 
87 #endif // ASIO_DETAIL_IMPL_SELECT_REACTOR_HPP
void remove_timer_queue(timer_queue< Time_Traits > &queue)
std::size_t cancel_timer(timer_queue< Time_Traits > &queue, typename timer_queue< Time_Traits >::per_timer_data &timer, std::size_t max_cancelled=(std::numeric_limits< std::size_t >::max)())
bool enqueue_timer(const time_type &time, per_timer_data &timer, wait_op *op)
Definition: timer_queue.hpp:75
void schedule_timer(timer_queue< Time_Traits > &queue, const typename Time_Traits::time_type &time, typename timer_queue< Time_Traits >::per_timer_data &timer, wait_op *op)
void add_timer_queue(timer_queue< Time_Traits > &queue)
std::size_t cancel_timer(per_timer_data &timer, op_queue< operation > &ops, std::size_t max_cancelled=(std::numeric_limits< std::size_t >::max)())