We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d6bb3f9 commit 38ea886Copy full SHA for 38ea886
support/unix/waitio.c
@@ -36,19 +36,19 @@
36
#include <sys/poll.h>
37
#endif
38
39
+/* convert microseconds to milliseconds (round up) */
40
+#define USEC_TO_MSEC(t) ((t) > 0 ? ((t) + 999) / 1000 : (t))
41
+
42
apr_status_t apr_wait_for_io_or_timeout(apr_file_t *f, apr_socket_t *s,
43
int for_read)
44
{
45
struct pollfd pfd;
46
int rc, timeout;
47
- timeout = f ? f->timeout : s->timeout;
- pfd.fd = f ? f->filedes : s->socketdes;
- pfd.events = for_read ? POLLIN : POLLOUT;
48
+ timeout = f ? USEC_TO_MSEC(f->timeout) : USEC_TO_MSEC(s->timeout);
49
+ pfd.fd = f ? f->filedes : s->socketdes;
50
+ pfd.events = for_read ? POLLIN : POLLOUT;
51
- if (timeout > 0) {
- timeout = (timeout + 999) / 1000;
- }
52
do {
53
rc = poll(&pfd, 1, timeout);
54
} while (rc == -1 && errno == EINTR);
0 commit comments