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

--- a/src/signaler.cpp
+++ b/src/signaler.cpp
@@ -86,7 +86,8 @@ static int sleep_ms (unsigned int ms_)
usleep (ms_ * 1000);
return 0;
#else
- return usleep (ms_ * 1000);
+ const struct timespec req = {0, (long int)ms_ * 1000 * 1000};
+ return nanosleep (&req, NULL);
#endif
}
--- a/src/tcp_address.cpp
+++ b/src/tcp_address.cpp
@@ -29,6 +29,7 @@
#include <string>
#include <sstream>
+#include <ctime>
#include "tcp_address.hpp"
#include "platform.hpp"
@@ -194,7 +195,8 @@ int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv6_, bool is_
rc = getifaddrs (&ifa);
if (rc == 0 || (rc < 0 && errno != ECONNREFUSED))
break;
- usleep ((backoff_msec << i) * 1000);
+ const struct timespec req = {0, (backoff_msec << i) * 1000 * 1000};
+ nanosleep (&req, NULL);
}
errno_assert (rc == 0);
zmq_assert (ifa != NULL);
--- a/src/zmq.cpp
+++ b/src/zmq.cpp
@@ -692,7 +692,8 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
usleep (timeout_ * 1000);
return 0;
#else
- return usleep (timeout_ * 1000);
+ const struct timespec req = {0, timeout_ * 1000 * 1000};
+ return nanosleep (&req, NULL);
#endif
}
@@ -852,7 +853,8 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
Sleep (timeout_ > 0 ? timeout_ : INFINITE);
return 0;
#else
- return usleep (timeout_ * 1000);
+ const struct timespec req = {0, timeout_ * 1000 * 1000};
+ return nanosleep (&req, NULL);
#endif
}
zmq::clock_t clock;