Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:28:41

0001 //
0002 // detail/null_event.hpp
0003 // ~~~~~~~~~~~~~~~~~~~~~
0004 //
0005 // Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 //
0010 
0011 #ifndef BOOST_ASIO_DETAIL_NULL_EVENT_HPP
0012 #define BOOST_ASIO_DETAIL_NULL_EVENT_HPP
0013 
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
0017 
0018 #include <boost/asio/detail/config.hpp>
0019 #include <boost/asio/detail/noncopyable.hpp>
0020 
0021 #include <boost/asio/detail/push_options.hpp>
0022 
0023 namespace boost {
0024 namespace asio {
0025 namespace detail {
0026 
0027 class null_event
0028   : private noncopyable
0029 {
0030 public:
0031   // Constructor.
0032   null_event()
0033   {
0034   }
0035 
0036   // Destructor.
0037   ~null_event()
0038   {
0039   }
0040 
0041   // Signal the event. (Retained for backward compatibility.)
0042   template <typename Lock>
0043   void signal(Lock&)
0044   {
0045   }
0046 
0047   // Signal all waiters.
0048   template <typename Lock>
0049   void signal_all(Lock&)
0050   {
0051   }
0052 
0053   // Unlock the mutex and signal one waiter.
0054   template <typename Lock>
0055   void unlock_and_signal_one(Lock&)
0056   {
0057   }
0058 
0059   // Unlock the mutex and signal one waiter who may destroy us.
0060   template <typename Lock>
0061   void unlock_and_signal_one_for_destruction(Lock&)
0062   {
0063   }
0064 
0065   // If there's a waiter, unlock the mutex and signal it.
0066   template <typename Lock>
0067   bool maybe_unlock_and_signal_one(Lock&)
0068   {
0069     return false;
0070   }
0071 
0072   // Reset the event.
0073   template <typename Lock>
0074   void clear(Lock&)
0075   {
0076   }
0077 
0078   // Wait for the event to become signalled.
0079   template <typename Lock>
0080   void wait(Lock&)
0081   {
0082     do_wait();
0083   }
0084 
0085   // Timed wait for the event to become signalled.
0086   template <typename Lock>
0087   bool wait_for_usec(Lock&, long usec)
0088   {
0089     do_wait_for_usec(usec);
0090     return true;
0091   }
0092 
0093 private:
0094   BOOST_ASIO_DECL static void do_wait();
0095   BOOST_ASIO_DECL static void do_wait_for_usec(long usec);
0096 };
0097 
0098 } // namespace detail
0099 } // namespace asio
0100 } // namespace boost
0101 
0102 #include <boost/asio/detail/pop_options.hpp>
0103 
0104 #if defined(BOOST_ASIO_HEADER_ONLY)
0105 # include <boost/asio/detail/impl/null_event.ipp>
0106 #endif // defined(BOOST_ASIO_HEADER_ONLY)
0107 
0108 #endif // BOOST_ASIO_DETAIL_NULL_EVENT_HPP