Statistics
| Revision:

root / tmp / org.txm.statsengine.r.core.win32 / res / win32 / library / BH / include / boost / asio / detail / impl / kqueue_reactor.hpp @ 2486

History | View | Annotate | Download (2.2 kB)

1 2486 sjacqu01
//
2 2486 sjacqu01
// detail/impl/kqueue_reactor.hpp
3 2486 sjacqu01
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 2486 sjacqu01
//
5 2486 sjacqu01
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 2486 sjacqu01
// Copyright (c) 2005 Stefan Arentz (stefan at soze dot com)
7 2486 sjacqu01
//
8 2486 sjacqu01
// Distributed under the Boost Software License, Version 1.0. (See accompanying
9 2486 sjacqu01
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
10 2486 sjacqu01
//
11 2486 sjacqu01
12 2486 sjacqu01
#ifndef BOOST_ASIO_DETAIL_IMPL_KQUEUE_REACTOR_HPP
13 2486 sjacqu01
#define BOOST_ASIO_DETAIL_IMPL_KQUEUE_REACTOR_HPP
14 2486 sjacqu01
15 2486 sjacqu01
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 2486 sjacqu01
# pragma once
17 2486 sjacqu01
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 2486 sjacqu01
19 2486 sjacqu01
#include <boost/asio/detail/config.hpp>
20 2486 sjacqu01
21 2486 sjacqu01
#if defined(BOOST_ASIO_HAS_KQUEUE)
22 2486 sjacqu01
23 2486 sjacqu01
#include <boost/asio/detail/push_options.hpp>
24 2486 sjacqu01
25 2486 sjacqu01
namespace boost {
26 2486 sjacqu01
namespace asio {
27 2486 sjacqu01
namespace detail {
28 2486 sjacqu01
29 2486 sjacqu01
template <typename Time_Traits>
30 2486 sjacqu01
void kqueue_reactor::add_timer_queue(timer_queue<Time_Traits>& queue)
31 2486 sjacqu01
{
32 2486 sjacqu01
  do_add_timer_queue(queue);
33 2486 sjacqu01
}
34 2486 sjacqu01
35 2486 sjacqu01
// Remove a timer queue from the reactor.
36 2486 sjacqu01
template <typename Time_Traits>
37 2486 sjacqu01
void kqueue_reactor::remove_timer_queue(timer_queue<Time_Traits>& queue)
38 2486 sjacqu01
{
39 2486 sjacqu01
  do_remove_timer_queue(queue);
40 2486 sjacqu01
}
41 2486 sjacqu01
42 2486 sjacqu01
template <typename Time_Traits>
43 2486 sjacqu01
void kqueue_reactor::schedule_timer(timer_queue<Time_Traits>& queue,
44 2486 sjacqu01
    const typename Time_Traits::time_type& time,
45 2486 sjacqu01
    typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op)
46 2486 sjacqu01
{
47 2486 sjacqu01
  boost::asio::detail::mutex::scoped_lock lock(mutex_);
48 2486 sjacqu01
49 2486 sjacqu01
  if (shutdown_)
50 2486 sjacqu01
  {
51 2486 sjacqu01
    io_service_.post_immediate_completion(op, false);
52 2486 sjacqu01
    return;
53 2486 sjacqu01
  }
54 2486 sjacqu01
55 2486 sjacqu01
  bool earliest = queue.enqueue_timer(time, timer, op);
56 2486 sjacqu01
  io_service_.work_started();
57 2486 sjacqu01
  if (earliest)
58 2486 sjacqu01
    interrupt();
59 2486 sjacqu01
}
60 2486 sjacqu01
61 2486 sjacqu01
template <typename Time_Traits>
62 2486 sjacqu01
std::size_t kqueue_reactor::cancel_timer(timer_queue<Time_Traits>& queue,
63 2486 sjacqu01
    typename timer_queue<Time_Traits>::per_timer_data& timer,
64 2486 sjacqu01
    std::size_t max_cancelled)
65 2486 sjacqu01
{
66 2486 sjacqu01
  boost::asio::detail::mutex::scoped_lock lock(mutex_);
67 2486 sjacqu01
  op_queue<operation> ops;
68 2486 sjacqu01
  std::size_t n = queue.cancel_timer(timer, ops, max_cancelled);
69 2486 sjacqu01
  lock.unlock();
70 2486 sjacqu01
  io_service_.post_deferred_completions(ops);
71 2486 sjacqu01
  return n;
72 2486 sjacqu01
}
73 2486 sjacqu01
74 2486 sjacqu01
} // namespace detail
75 2486 sjacqu01
} // namespace asio
76 2486 sjacqu01
} // namespace boost
77 2486 sjacqu01
78 2486 sjacqu01
#include <boost/asio/detail/pop_options.hpp>
79 2486 sjacqu01
80 2486 sjacqu01
#endif // defined(BOOST_ASIO_HAS_KQUEUE)
81 2486 sjacqu01
82 2486 sjacqu01
#endif // BOOST_ASIO_DETAIL_IMPL_KQUEUE_REACTOR_HPP