Realistic 3D camera system
3D camera system components
dev_poll_reactor.hpp
Go to the documentation of this file.
1 //
2 // detail/impl/dev_poll_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_DEV_POLL_REACTOR_HPP
12 #define ASIO_DETAIL_IMPL_DEV_POLL_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_DEV_POLL)
21 
23 
24 namespace asio {
25 namespace detail {
26 
27 template <typename Time_Traits>
28 void dev_poll_reactor::add_timer_queue(timer_queue<Time_Traits>& queue)
29 {
30  do_add_timer_queue(queue);
31 }
32 
33 template <typename Time_Traits>
34 void dev_poll_reactor::remove_timer_queue(timer_queue<Time_Traits>& queue)
35 {
36  do_remove_timer_queue(queue);
37 }
38 
39 template <typename Time_Traits>
40 void dev_poll_reactor::schedule_timer(timer_queue<Time_Traits>& queue,
41  const typename Time_Traits::time_type& time,
42  typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op)
43 {
45 
46  if (shutdown_)
47  {
48  io_service_.post_immediate_completion(op, false);
49  return;
50  }
51 
52  bool earliest = queue.enqueue_timer(time, timer, op);
53  io_service_.work_started();
54  if (earliest)
55  interrupter_.interrupt();
56 }
57 
58 template <typename Time_Traits>
59 std::size_t dev_poll_reactor::cancel_timer(timer_queue<Time_Traits>& queue,
60  typename timer_queue<Time_Traits>::per_timer_data& timer,
61  std::size_t max_cancelled)
62 {
64  op_queue<operation> ops;
65  std::size_t n = queue.cancel_timer(timer, ops, max_cancelled);
66  lock.unlock();
67  io_service_.post_deferred_completions(ops);
68  return n;
69 }
70 
71 } // namespace detail
72 } // namespace asio
73 
75 
76 #endif // defined(ASIO_HAS_DEV_POLL)
77 
78 #endif // ASIO_DETAIL_IMPL_DEV_POLL_REACTOR_HPP