From: Stephan Bosch Date: Sat, 9 Nov 2019 09:47:04 +0000 (+0100) Subject: lib: iostream-pump - Add support for switching to an explicit ioloop. X-Git-Tag: 2.3.11.2~294 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ba4fc7415423784850da1794dc19e371f8bdb54e;p=thirdparty%2Fdovecot%2Fcore.git lib: iostream-pump - Add support for switching to an explicit ioloop. --- diff --git a/src/lib/iostream-pump.c b/src/lib/iostream-pump.c index dee0687522..cebae3dd8b 100644 --- a/src/lib/iostream-pump.c +++ b/src/lib/iostream-pump.c @@ -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); } diff --git a/src/lib/iostream-pump.h b/src/lib/iostream-pump.h index 95fdfb7e10..d7317ae2f9 100644 --- a/src/lib/iostream-pump.h +++ b/src/lib/iostream-pump.h @@ -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