null_event.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //
  2. // detail/null_event.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. #ifndef BOOST_ASIO_DETAIL_NULL_EVENT_HPP
  11. #define BOOST_ASIO_DETAIL_NULL_EVENT_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. #if !defined(BOOST_ASIO_HAS_THREADS)
  17. #include <boost/asio/detail/noncopyable.hpp>
  18. #include <boost/asio/detail/push_options.hpp>
  19. namespace boost {
  20. namespace asio {
  21. namespace detail {
  22. class null_event
  23. : private noncopyable
  24. {
  25. public:
  26. // Constructor.
  27. null_event()
  28. {
  29. }
  30. // Destructor.
  31. ~null_event()
  32. {
  33. }
  34. // Signal the event. (Retained for backward compatibility.)
  35. template <typename Lock>
  36. void signal(Lock&)
  37. {
  38. }
  39. // Signal all waiters.
  40. template <typename Lock>
  41. void signal_all(Lock&)
  42. {
  43. }
  44. // Unlock the mutex and signal one waiter.
  45. template <typename Lock>
  46. void unlock_and_signal_one(Lock&)
  47. {
  48. }
  49. // If there's a waiter, unlock the mutex and signal it.
  50. template <typename Lock>
  51. bool maybe_unlock_and_signal_one(Lock&)
  52. {
  53. return false;
  54. }
  55. // Reset the event.
  56. template <typename Lock>
  57. void clear(Lock&)
  58. {
  59. }
  60. // Wait for the event to become signalled.
  61. template <typename Lock>
  62. void wait(Lock&)
  63. {
  64. }
  65. };
  66. } // namespace detail
  67. } // namespace asio
  68. } // namespace boost
  69. #include <boost/asio/detail/pop_options.hpp>
  70. #endif // !defined(BOOST_ASIO_HAS_THREADS)
  71. #endif // BOOST_ASIO_DETAIL_NULL_EVENT_HPP