dovecot: Delay initializing ioloop backend until it's needed.
dovecot at dovecot.org
dovecot at dovecot.org
Mon Jul 9 07:04:58 EEST 2007
details: http://hg.dovecot.org/dovecot/rev/8f1d94246a8f
changeset: 5939:8f1d94246a8f
user: Timo Sirainen <tss at iki.fi>
date: Mon Jul 09 07:04:51 2007 +0300
description:
Delay initializing ioloop backend until it's needed.
diffstat:
1 file changed, 8 insertions(+), 3 deletions(-)
src/lib/ioloop.c | 11 ++++++++---
diffs (42 lines):
diff -r 805f2527a982 -r 8f1d94246a8f src/lib/ioloop.c
--- a/src/lib/ioloop.c Mon Jul 09 07:01:08 2007 +0300
+++ b/src/lib/ioloop.c Mon Jul 09 07:04:51 2007 +0300
@@ -36,6 +36,8 @@ struct io *io_add(int fd, enum io_condit
io->refcount = 1;
io->fd = fd;
+ if (current_ioloop->handler_context == NULL)
+ io_loop_handler_init(current_ioloop);
io_loop_handle_add(current_ioloop, io);
if (current_ioloop->io_files != NULL) {
@@ -293,7 +295,10 @@ void io_loop_handle_timeouts(struct iolo
void io_loop_run(struct ioloop *ioloop)
{
- ioloop->running = TRUE;
+ if (ioloop->handler_context == NULL)
+ io_loop_handler_init(ioloop);
+
+ ioloop->running = TRUE;
while (ioloop->running)
io_loop_handler_run(ioloop);
}
@@ -323,7 +328,6 @@ struct ioloop *io_loop_create(void)
ioloop_time = ioloop_timeval.tv_sec;
ioloop = i_new(struct ioloop, 1);
- io_loop_handler_init(ioloop);
ioloop->prev = current_ioloop;
current_ioloop = ioloop;
@@ -357,7 +361,8 @@ void io_loop_destroy(struct ioloop **_io
i_free(to);
}
- io_loop_handler_deinit(ioloop);
+ if (current_ioloop->handler_context != NULL)
+ io_loop_handler_deinit(ioloop);
/* ->prev won't work unless loops are destroyed in create order */
i_assert(ioloop == current_ioloop);
More information about the dovecot-cvs
mailing list