You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.6 KiB

  1. --- a/src/signaler.cpp
  2. +++ b/src/signaler.cpp
  3. @@ -86,7 +86,8 @@ static int sleep_ms (unsigned int ms_)
  4. usleep (ms_ * 1000);
  5. return 0;
  6. #else
  7. - return usleep (ms_ * 1000);
  8. + const struct timespec req = {0, (long int)ms_ * 1000 * 1000};
  9. + return nanosleep (&req, NULL);
  10. #endif
  11. }
  12. --- a/src/tcp_address.cpp
  13. +++ b/src/tcp_address.cpp
  14. @@ -29,6 +29,7 @@
  15. #include <string>
  16. #include <sstream>
  17. +#include <ctime>
  18. #include "tcp_address.hpp"
  19. #include "platform.hpp"
  20. @@ -194,7 +195,8 @@ int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv6_, bool is_
  21. rc = getifaddrs (&ifa);
  22. if (rc == 0 || (rc < 0 && errno != ECONNREFUSED))
  23. break;
  24. - usleep ((backoff_msec << i) * 1000);
  25. + const struct timespec req = {0, (backoff_msec << i) * 1000 * 1000};
  26. + nanosleep (&req, NULL);
  27. }
  28. errno_assert (rc == 0);
  29. zmq_assert (ifa != NULL);
  30. --- a/src/zmq.cpp
  31. +++ b/src/zmq.cpp
  32. @@ -692,7 +692,8 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
  33. usleep (timeout_ * 1000);
  34. return 0;
  35. #else
  36. - return usleep (timeout_ * 1000);
  37. + const struct timespec req = {0, timeout_ * 1000 * 1000};
  38. + return nanosleep (&req, NULL);
  39. #endif
  40. }
  41. @@ -852,7 +853,8 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
  42. Sleep (timeout_ > 0 ? timeout_ : INFINITE);
  43. return 0;
  44. #else
  45. - return usleep (timeout_ * 1000);
  46. + const struct timespec req = {0, timeout_ * 1000 * 1000};
  47. + return nanosleep (&req, NULL);
  48. #endif
  49. }
  50. zmq::clock_t clock;