commit 5456f2e1d5656398347377e7a830fc47b7cfefbf
parent 062c80c1acc83a5cc92fc1d0b5731670403dd1ee
Author: Joris Vink <joris@coders.se>
Date: Tue, 30 Oct 2018 12:37:30 +0100
save/restore coro_running in pygather_op_dealloc().
Diffstat:
1 file changed, 11 insertions(+), 0 deletions(-)
diff --git a/src/python.c b/src/python.c
@@ -2402,9 +2402,18 @@ pygather_reap_coro(struct pygather_op *op, struct python_coro *reap)
static void
pygather_op_dealloc(struct pygather_op *op)
{
+ struct python_coro *old;
struct pygather_coro *coro, *next;
struct pygather_result *res, *rnext;
+ /*
+ * Since we are calling kore_python_coro_delete() on all the
+ * remaining coroutines in this gather op we must remember the
+ * original coroutine that is running as the removal will end
+ * up setting coro_running to NULL.
+ */
+ old = coro_running;
+
for (coro = TAILQ_FIRST(&op->coroutines); coro != NULL; coro = next) {
next = TAILQ_NEXT(coro, list);
TAILQ_REMOVE(&op->coroutines, coro, list);
@@ -2416,6 +2425,8 @@ pygather_op_dealloc(struct pygather_op *op)
kore_pool_put(&gather_coro_pool, coro);
}
+ coro_running = old;
+
for (res = TAILQ_FIRST(&op->results); res != NULL; res = rnext) {
rnext = TAILQ_NEXT(res, list);
TAILQ_REMOVE(&op->results, res, list);