mirror of https://git.kore.io/kore.git
save/restore coro_running in pygather_op_dealloc().
This commit is contained in:
parent
062c80c1ac
commit
5456f2e1d5
11
src/python.c
11
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);
|
||||
|
|
Loading…
Reference in New Issue