]> 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)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Wed, 12 Sep 2018 06:11:03 +0000 (09:11 +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 ef5b0ef937d02f30ac825cc0ecc4b098ee18a1a7..425ce217ae022d0917a7c7dc2ce28319d772d13c 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 62f72b2bf8df542d742354bdb74fa2a41e6b6d77..8ba57e6d9bb231eae8fbfe9ac3ee1b5c69046515 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 b140c6f54d2eb0259b747db5237e5e59c67ab9f7..77dfcdec74146abc84c2ed1273e7c7551a2660d0 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 cee011f41cbca7c2359cb3c4c1712dd57c5206a3..d604685c9626f87470ab6c99b8b1b84ec7c62842 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 c88561f62c9fd261fb186a8645f11fc7a661ba51..650c6ebeacf5a9aa7dab7e5237d720a6261a91c0 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;