timer_queue_set.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //
  2. // detail/timer_queue_set.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2018 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. #ifndef BOOST_ASIO_DETAIL_TIMER_QUEUE_SET_HPP
  11. #define BOOST_ASIO_DETAIL_TIMER_QUEUE_SET_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include <boost/asio/detail/config.hpp>
  16. #include <boost/asio/detail/timer_queue_base.hpp>
  17. #include <boost/asio/detail/push_options.hpp>
  18. namespace boost {
  19. namespace asio {
  20. namespace detail {
  21. class timer_queue_set
  22. {
  23. public:
  24. // Constructor.
  25. BOOST_ASIO_DECL timer_queue_set();
  26. // Add a timer queue to the set.
  27. BOOST_ASIO_DECL void insert(timer_queue_base* q);
  28. // Remove a timer queue from the set.
  29. BOOST_ASIO_DECL void erase(timer_queue_base* q);
  30. // Determine whether all queues are empty.
  31. BOOST_ASIO_DECL bool all_empty() const;
  32. // Get the wait duration in milliseconds.
  33. BOOST_ASIO_DECL long wait_duration_msec(long max_duration) const;
  34. // Get the wait duration in microseconds.
  35. BOOST_ASIO_DECL long wait_duration_usec(long max_duration) const;
  36. // Dequeue all ready timers.
  37. BOOST_ASIO_DECL void get_ready_timers(op_queue<operation>& ops);
  38. // Dequeue all timers.
  39. BOOST_ASIO_DECL void get_all_timers(op_queue<operation>& ops);
  40. private:
  41. timer_queue_base* first_;
  42. };
  43. } // namespace detail
  44. } // namespace asio
  45. } // namespace boost
  46. #include <boost/asio/detail/pop_options.hpp>
  47. #if defined(BOOST_ASIO_HEADER_ONLY)
  48. # include <boost/asio/detail/impl/timer_queue_set.ipp>
  49. #endif // defined(BOOST_ASIO_HEADER_ONLY)
  50. #endif // BOOST_ASIO_DETAIL_TIMER_QUEUE_SET_HPP