]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
ioloop: Use -1 for infinite poll/epoll timeout rather than INT_MAX.
authorTimo Sirainen <tss@iki.fi>
Wed, 26 Jan 2011 19:47:52 +0000 (21:47 +0200)
committerTimo Sirainen <tss@iki.fi>
Wed, 26 Jan 2011 19:47:52 +0000 (21:47 +0200)
Should improve performance a tiny bit and also works around a CPU eater bug
in Linux 2.6.37.

src/lib/ioloop.c

index 5d393a3d5e40086b4c1458458bd92c58c2cac9fb..9ce1f44820f993a41ac7667ab87be21c770ca181 100644 (file)
@@ -252,11 +252,12 @@ int io_loop_get_wait_time(struct ioloop *ioloop, struct timeval *tv_r)
        item = priorityq_peek(ioloop->timeouts);
        timeout = (struct timeout *)item;
        if (timeout == NULL) {
-               /* no timeouts. give it INT_MAX msecs. */
+               /* no timeouts. use INT_MAX msecs for timeval and
+                  return -1 for poll/epoll infinity. */
                tv_r->tv_sec = INT_MAX / 1000;
                tv_r->tv_usec = 0;
                ioloop->next_max_time = (1ULL << (TIME_T_MAX_BITS-1)) - 1;
-               return INT_MAX;
+               return -1;
        }
 
        tv_now.tv_sec = 0;