summaryrefslogtreecommitdiffstats
path: root/poll/unix/poll.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--poll/unix/poll.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/poll/unix/poll.c b/poll/unix/poll.c
index 5b878f1..28090c4 100644
--- a/poll/unix/poll.c
+++ b/poll/unix/poll.c
@@ -114,7 +114,8 @@ APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t num,
num_to_poll = i;
if (timeout > 0) {
- timeout /= 1000; /* convert microseconds to milliseconds */
+ /* convert microseconds to milliseconds (round up) */
+ timeout = (timeout + 999) / 1000;
}
i = poll(pollset, num_to_poll, timeout);
@@ -252,14 +253,15 @@ static apr_status_t impl_pollset_poll(apr_pollset_t *pollset,
}
return APR_SUCCESS;
}
+#endif
+
if (timeout > 0) {
- timeout /= 1000;
+ timeout = (timeout + 999) / 1000;
}
+
+#ifdef WIN32
ret = WSAPoll(pollset->p->pollset, pollset->nelts, (int)timeout);
#else
- if (timeout > 0) {
- timeout /= 1000;
- }
ret = poll(pollset->p->pollset, pollset->nelts, timeout);
#endif
if (ret < 0) {
@@ -407,14 +409,15 @@ static apr_status_t impl_pollcb_poll(apr_pollcb_t *pollcb,
}
return APR_SUCCESS;
}
+#endif
+
if (timeout > 0) {
- timeout /= 1000;
+ timeout = (timeout + 999) / 1000;
}
+
+#ifdef WIN32
ret = WSAPoll(pollcb->pollset.ps, pollcb->nelts, (int)timeout);
#else
- if (timeout > 0) {
- timeout /= 1000;
- }
ret = poll(pollcb->pollset.ps, pollcb->nelts, timeout);
#endif
if (ret < 0) {