r5393: trigger timed events not to early, better do it a bit to late
authorStefan Metzmacher <metze@samba.org>
Mon, 14 Feb 2005 09:43:36 +0000 (09:43 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:09:50 +0000 (13:09 -0500)
metze
(This used to be commit 67bf637e9a44202061fd71c92142f835ba76da89)

source4/lib/events/events_standard.c

index 97836037593e239a2bb823ee0a525fec7552b565..77797eec64fda485af92fe70410ac356ac6fc519 100644 (file)
@@ -380,7 +380,8 @@ static int event_loop_epoll(struct event_context *ev, struct timeval *tvalp)
        int timeout = -1;
 
        if (tvalp) {
-               timeout = (tvalp->tv_usec / 1000) + (tvalp->tv_sec*1000);
+               /* it's better to trigger timed events a bit later than to early */
+               timeout = ((tvalp->tv_usec+999) / 1000) + (tvalp->tv_sec*1000);
        }
 
        ret = epoll_wait(ev->epoll_fd, events, maxevents, timeout);