Esempio n. 1
0
  void do_wait(const Duration& timeout, asio::error_code& ec)
  {
#if defined(ASIO_WINDOWS_RUNTIME)
    std::this_thread::sleep_for(
        std::chrono::seconds(timeout.total_seconds())
        + std::chrono::microseconds(timeout.total_microseconds()));
    ec = asio::error_code();
#else // defined(ASIO_WINDOWS_RUNTIME)
    ::timeval tv;
    tv.tv_sec = timeout.total_seconds();
    tv.tv_usec = timeout.total_microseconds() % 1000000;
    socket_ops::select(0, 0, 0, 0, &tv, ec);
#endif // defined(ASIO_WINDOWS_RUNTIME)
  }
 void do_wait(const Duration& timeout, pdalboost::system::error_code& ec)
 {
   ::timeval tv;
   tv.tv_sec = timeout.total_seconds();
   tv.tv_usec = timeout.total_microseconds() % 1000000;
   socket_ops::select(0, 0, 0, 0, &tv, ec);
 }
Esempio n. 3
0
 long to_usec(const Duration& d, long max_duration) const
 {
   if (d.ticks() <= 0)
     return 0;
   int64_t usec = d.total_microseconds();
   if (usec == 0)
     return 1;
   if (usec > max_duration)
     return max_duration;
   return static_cast<long>(usec);
 }