Mercurial > dovecot > original-hg > dovecot-1.2
changeset 5330:1dcd1631f06e HEAD
If poll()/etc. timeouts, we didn't handle time timeouts immediately but
called poll()/etc again with zero timeout and then handled the timeouts.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 15 Mar 2007 16:38:25 +0200 |
parents | a065a71da7d7 |
children | e505fa0cecdc |
files | src/lib/ioloop-epoll.c src/lib/ioloop-internal.h src/lib/ioloop-kqueue.c src/lib/ioloop-poll.c src/lib/ioloop-select.c src/lib/ioloop.c |
diffstat | 6 files changed, 9 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib/ioloop-epoll.c Thu Mar 15 16:31:18 2007 +0200 +++ b/src/lib/ioloop-epoll.c Thu Mar 15 16:38:25 2007 +0200 @@ -170,7 +170,7 @@ i_fatal("epoll_wait(): %m"); /* execute timeout handlers */ - io_loop_handle_timeouts(ioloop); + io_loop_handle_timeouts(ioloop, ret == 0); if (!ioloop->running) return;
--- a/src/lib/ioloop-internal.h Thu Mar 15 16:31:18 2007 +0200 +++ b/src/lib/ioloop-internal.h Thu Mar 15 16:38:25 2007 +0200 @@ -52,7 +52,7 @@ int io_loop_get_wait_time(struct timeout *timeout, struct timeval *tv, struct timeval *tv_now); -void io_loop_handle_timeouts(struct ioloop *ioloop); +void io_loop_handle_timeouts(struct ioloop *ioloop, bool update_run_now); /* I/O handler calls */ void io_loop_handle_add(struct ioloop *ioloop, struct io_file *io);
--- a/src/lib/ioloop-kqueue.c Thu Mar 15 16:31:18 2007 +0200 +++ b/src/lib/ioloop-kqueue.c Thu Mar 15 16:38:25 2007 +0200 @@ -140,7 +140,7 @@ } /* execute timeout handlers */ - io_loop_handle_timeouts(ioloop); + io_loop_handle_timeouts(ioloop, ret == 0); for (i = 0; i < ret; i++) { /* io_loop_handle_add() may cause events array reallocation,
--- a/src/lib/ioloop-poll.c Thu Mar 15 16:31:18 2007 +0200 +++ b/src/lib/ioloop-poll.c Thu Mar 15 16:38:25 2007 +0200 @@ -156,7 +156,7 @@ i_fatal("poll(): %m"); /* execute timeout handlers */ - io_loop_handle_timeouts(ioloop); + io_loop_handle_timeouts(ioloop, ret == 0); if (ret <= 0 || !ioloop->running) { /* no I/O events */
--- a/src/lib/ioloop-select.c Thu Mar 15 16:31:18 2007 +0200 +++ b/src/lib/ioloop-select.c Thu Mar 15 16:38:25 2007 +0200 @@ -123,7 +123,7 @@ i_warning("select() : %m"); /* execute timeout handlers */ - io_loop_handle_timeouts(ioloop); + io_loop_handle_timeouts(ioloop, ret == 0); if (ret <= 0 || !ioloop->running) { /* no I/O events */
--- a/src/lib/ioloop.c Thu Mar 15 16:31:18 2007 +0200 +++ b/src/lib/ioloop.c Thu Mar 15 16:38:25 2007 +0200 @@ -182,7 +182,7 @@ return 0; } -void io_loop_handle_timeouts(struct ioloop *ioloop) +void io_loop_handle_timeouts(struct ioloop *ioloop, bool update_run_now) { struct timeout *called_timeouts; struct timeval tv; @@ -220,13 +220,14 @@ } /* Try again. */ - io_loop_handle_timeouts(ioloop); + io_loop_handle_timeouts(ioloop, TRUE); } } ioloop_time = ioloop_timeval.tv_sec; - if (ioloop->timeouts == NULL || !ioloop->timeouts->run_now) + if (ioloop->timeouts == NULL || + (!ioloop->timeouts->run_now && !update_run_now)) return; called_timeouts = NULL;