]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Add and use io_loop_run_get_wait_time()
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 17 Aug 2018 08:29:30 +0000 (11:29 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 22 Aug 2018 10:45:59 +0000 (13:45 +0300)
This is going to be called just before running an ioloop iteration.
The next commit improves its behavior.

src/lib/ioloop-epoll.c
src/lib/ioloop-kqueue.c
src/lib/ioloop-poll.c
src/lib/ioloop-private.h
src/lib/ioloop-select.c
src/lib/ioloop.c

index cbba942ef1136f0434cc6607e89c2998543a8029..5aac59a37ae53ee49a07fe68b29a1133b245f80f 100644 (file)
@@ -175,7 +175,7 @@ void io_loop_handler_run_internal(struct ioloop *ioloop)
        i_assert(ctx != NULL);
 
         /* get the time left for next timeout task */
-       msecs = io_loop_get_wait_time(ioloop, &tv);
+       msecs = io_loop_run_get_wait_time(ioloop, &tv);
 
        events = array_get_modifiable(&ctx->events, &events_count);
        if (ioloop->io_files != NULL && events_count > ctx->deleted_count) {
index 9c22b748d9ee9ba7f4859e635690b113c3ec1341..3050c61af686d9319459939e3b774e4432814f10 100644 (file)
@@ -119,7 +119,7 @@ void io_loop_handler_run_internal(struct ioloop *ioloop)
        int ret, i, msecs;
 
        /* get the time left for next timeout task */
-       msecs = io_loop_get_wait_time(ioloop, &tv);
+       msecs = io_loop_run_get_wait_time(ioloop, &tv);
        ts.tv_sec = tv.tv_sec;
        ts.tv_nsec = tv.tv_usec * 1000;
 
index 9f208192e73afe04a70a861b1b28404210900933..4016dae6a345948e35be614a3844301254a85389 100644 (file)
@@ -151,7 +151,7 @@ void io_loop_handler_run_internal(struct ioloop *ioloop)
        bool call;
 
         /* get the time left for next timeout task */
-       msecs = io_loop_get_wait_time(ioloop, &tv);
+       msecs = io_loop_run_get_wait_time(ioloop, &tv);
 #ifdef _AIX
        if (msecs > 1000) {
                /* AIX seems to check IO_POLL_ERRORs only at the beginning of
index 1a49ae9c89be02034532978ef1ec60a54f0a25bf..d134b3f91cd2659d16070cb75db3ea8fc990e07f 100644 (file)
@@ -102,7 +102,7 @@ struct ioloop_context {
        ARRAY(struct ioloop_context_callback) callbacks;
 };
 
-int io_loop_get_wait_time(struct ioloop *ioloop, struct timeval *tv_r);
+int io_loop_run_get_wait_time(struct ioloop *ioloop, struct timeval *tv_r);
 void io_loop_handle_timeouts(struct ioloop *ioloop);
 void io_loop_call_io(struct io *io);
 
index 4c8fca57a9421544b1537ea42a8c28512e0e9f41..d5deb160acb413a6a5550a4479b1632da8d779a6 100644 (file)
@@ -111,7 +111,7 @@ void io_loop_handler_run_internal(struct ioloop *ioloop)
        int ret;
 
        /* get the time left for next timeout task */
-       io_loop_get_wait_time(ioloop, &tv);
+       io_loop_run_get_wait_time(ioloop, &tv);
 
        memcpy(&ctx->tmp_read_fds, &ctx->read_fds, sizeof(fd_set));
        memcpy(&ctx->tmp_write_fds, &ctx->write_fds, sizeof(fd_set));
index d4dd9c011bfbb3109e388c8bbe6c0d46fb334073..af708ec19582598515ef03124dc7b97d8db598c4 100644 (file)
@@ -470,7 +470,7 @@ static int timeout_get_wait_time(struct timeout *timeout, struct timeval *tv_r,
        return ret;
 }
 
-int io_loop_get_wait_time(struct ioloop *ioloop, struct timeval *tv_r)
+static int io_loop_get_wait_time(struct ioloop *ioloop, struct timeval *tv_r)
 {
        struct timeval tv_now;
        struct priorityq_item *item;
@@ -512,6 +512,11 @@ int io_loop_get_wait_time(struct ioloop *ioloop, struct timeval *tv_r)
        return msecs;
 }
 
+int io_loop_run_get_wait_time(struct ioloop *ioloop, struct timeval *tv_r)
+{
+       return io_loop_get_wait_time(ioloop, tv_r);
+}
+
 static int timeout_cmp(const void *p1, const void *p2)
 {
        const struct timeout *to1 = p1, *to2 = p2;