]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/asio/detail/null_event.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / asio / detail / null_event.hpp
CommitLineData
7c673cae
FG
1//
2// detail/null_event.hpp
3// ~~~~~~~~~~~~~~~~~~~~~
4//
1e59de90 5// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7c673cae
FG
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 BOOST_ASIO_DETAIL_NULL_EVENT_HPP
12#define BOOST_ASIO_DETAIL_NULL_EVENT_HPP
13
14#if defined(_MSC_VER) && (_MSC_VER >= 1200)
15# pragma once
16#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17
18#include <boost/asio/detail/config.hpp>
7c673cae
FG
19#include <boost/asio/detail/noncopyable.hpp>
20
21#include <boost/asio/detail/push_options.hpp>
22
23namespace boost {
24namespace asio {
25namespace detail {
26
27class null_event
28 : private noncopyable
29{
30public:
31 // Constructor.
32 null_event()
33 {
34 }
35
36 // Destructor.
37 ~null_event()
38 {
39 }
40
41 // Signal the event. (Retained for backward compatibility.)
42 template <typename Lock>
43 void signal(Lock&)
44 {
45 }
46
47 // Signal all waiters.
48 template <typename Lock>
49 void signal_all(Lock&)
50 {
51 }
52
53 // Unlock the mutex and signal one waiter.
54 template <typename Lock>
55 void unlock_and_signal_one(Lock&)
56 {
57 }
58
20effc67
TL
59 // Unlock the mutex and signal one waiter who may destroy us.
60 template <typename Lock>
61 void unlock_and_signal_one_for_destruction(Lock&)
62 {
63 }
64
7c673cae
FG
65 // If there's a waiter, unlock the mutex and signal it.
66 template <typename Lock>
67 bool maybe_unlock_and_signal_one(Lock&)
68 {
69 return false;
70 }
71
72 // Reset the event.
73 template <typename Lock>
74 void clear(Lock&)
75 {
76 }
77
78 // Wait for the event to become signalled.
79 template <typename Lock>
80 void wait(Lock&)
81 {
b32b8144 82 do_wait();
7c673cae 83 }
b32b8144
FG
84
85 // Timed wait for the event to become signalled.
86 template <typename Lock>
87 bool wait_for_usec(Lock&, long usec)
88 {
89 do_wait_for_usec(usec);
90 return true;
91 }
92
93private:
94 BOOST_ASIO_DECL static void do_wait();
95 BOOST_ASIO_DECL static void do_wait_for_usec(long usec);
7c673cae
FG
96};
97
98} // namespace detail
99} // namespace asio
100} // namespace boost
101
102#include <boost/asio/detail/pop_options.hpp>
103
b32b8144
FG
104#if defined(BOOST_ASIO_HEADER_ONLY)
105# include <boost/asio/detail/impl/null_event.ipp>
106#endif // defined(BOOST_ASIO_HEADER_ONLY)
7c673cae
FG
107
108#endif // BOOST_ASIO_DETAIL_NULL_EVENT_HPP