File indexing completed on 2025-01-18 09:28:32
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_ASIO_DETAIL_IMPL_NULL_EVENT_IPP
0012 #define BOOST_ASIO_DETAIL_IMPL_NULL_EVENT_IPP
0013
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif
0017
0018 #include <boost/asio/detail/config.hpp>
0019
0020 #if defined(BOOST_ASIO_WINDOWS_RUNTIME)
0021 # include <thread>
0022 #elif defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
0023 # include <boost/asio/detail/socket_types.hpp>
0024 #else
0025 # include <unistd.h>
0026 # if defined(__hpux)
0027 # include <sys/time.h>
0028 # endif
0029 # if !defined(__hpux) || defined(__SELECT)
0030 # include <sys/select.h>
0031 # endif
0032 #endif
0033
0034 #include <boost/asio/detail/push_options.hpp>
0035
0036 namespace boost {
0037 namespace asio {
0038 namespace detail {
0039
0040 void null_event::do_wait()
0041 {
0042 #if defined(BOOST_ASIO_WINDOWS_RUNTIME)
0043 std::this_thread::sleep_until((std::chrono::steady_clock::time_point::max)());
0044 #elif defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
0045 ::Sleep(INFINITE);
0046 #else
0047 ::pause();
0048 #endif
0049 }
0050
0051 void null_event::do_wait_for_usec(long usec)
0052 {
0053 #if defined(BOOST_ASIO_WINDOWS_RUNTIME)
0054 std::this_thread::sleep_for(std::chrono::microseconds(usec));
0055 #elif defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
0056 ::Sleep(usec / 1000);
0057 #elif defined(__hpux) && defined(__SELECT)
0058 timespec ts;
0059 ts.tv_sec = usec / 1000000;
0060 ts.tv_nsec = (usec % 1000000) * 1000;
0061 ::pselect(0, 0, 0, 0, &ts, 0);
0062 #else
0063 timeval tv;
0064 tv.tv_sec = usec / 1000000;
0065 tv.tv_usec = usec % 1000000;
0066 ::select(0, 0, 0, 0, &tv);
0067 #endif
0068 }
0069
0070 }
0071 }
0072 }
0073
0074 #include <boost/asio/detail/pop_options.hpp>
0075
0076 #endif