2 // detail/impl/null_event.ipp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~
5 // Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
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)
11 #ifndef BOOST_ASIO_DETAIL_IMPL_NULL_EVENT_IPP
12 #define BOOST_ASIO_DETAIL_IMPL_NULL_EVENT_IPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/asio/detail/config.hpp>
20 #if defined(BOOST_ASIO_WINDOWS_RUNTIME)
22 #elif defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
23 # include <boost/asio/detail/socket_types.hpp>
27 # include <sys/time.h>
29 # if !defined(__hpux) || defined(__SELECT)
30 # include <sys/select.h>
34 #include <boost/asio/detail/push_options.hpp>
40 void null_event::do_wait()
42 #if defined(BOOST_ASIO_WINDOWS_RUNTIME)
43 std::this_thread::sleep_until((std::chrono::steady_clock::time_point::max)());
44 #elif defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
51 void null_event::do_wait_for_usec(long usec)
53 #if defined(BOOST_ASIO_WINDOWS_RUNTIME)
54 std::this_thread::sleep_for(std::chrono::microseconds(usec));
55 #elif defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
57 #elif defined(__hpux) && defined(__SELECT)
59 ts.tv_sec = usec / 1000000;
60 ts.tv_nsec = (usec % 1000000) * 1000;
61 ::pselect(0, 0, 0, 0, &ts, 0);
64 tv.tv_sec = usec / 1000000;
65 tv.tv_usec = usec % 1000000;
66 ::select(0, 0, 0, 0, &tv);
74 #include <boost/asio/detail/pop_options.hpp>
76 #endif // BOOST_ASIO_DETAIL_IMPL_NULL_EVENT_IPP