]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: iostream-pump - Add support for switching to an explicit ioloop.
authorStephan Bosch <stephan.bosch@open-xchange.com>
Sat, 9 Nov 2019 09:47:04 +0000 (10:47 +0100)
committermartti.rannanjarvi <martti.rannanjarvi@open-xchange.com>
Sat, 18 Apr 2020 14:55:11 +0000 (14:55 +0000)
src/lib/iostream-pump.c
src/lib/iostream-pump.h

index dee0687522af61e3ecb9be019da23c1e917ee7c4..cebae3dd8bc406330a4b0d9ae7627bcdf3c5bee4 100644 (file)
@@ -235,11 +235,17 @@ bool iostream_pump_is_waiting_output(struct iostream_pump *pump)
        return pump->waiting_output;
 }
 
-void iostream_pump_switch_ioloop(struct iostream_pump *pump)
+void iostream_pump_switch_ioloop_to(struct iostream_pump *pump,
+                                   struct ioloop *ioloop)
 {
        i_assert(pump != NULL);
        if (pump->io != NULL)
-               pump->io = io_loop_move_io(&pump->io);
-       o_stream_switch_ioloop(pump->output);
-       i_stream_switch_ioloop(pump->input);
+               pump->io = io_loop_move_io_to(ioloop, &pump->io);
+       o_stream_switch_ioloop_to(pump->output, ioloop);
+       i_stream_switch_ioloop_to(pump->input, ioloop);
+}
+
+void iostream_pump_switch_ioloop(struct iostream_pump *pump)
+{
+       iostream_pump_switch_ioloop_to(pump, current_ioloop);
 }
index 95fdfb7e1023396fa9f64abdf890e569c8961e0d..d7317ae2f95ccaff07f1f3dffa242a9c8370ae2f 100644 (file)
@@ -16,6 +16,7 @@
 
 struct istream;
 struct ostream;
+struct ioloop;
 struct iostream_pump;
 
 enum iostream_pump_status {
@@ -61,6 +62,8 @@ void iostream_pump_set_completion_callback(struct iostream_pump *pump,
    from the completion callback in error conditions. */
 bool iostream_pump_is_waiting_output(struct iostream_pump *pump);
 
+void iostream_pump_switch_ioloop_to(struct iostream_pump *pump,
+                                   struct ioloop *ioloop);
 void iostream_pump_switch_ioloop(struct iostream_pump *pump);
 
 #endif