aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2020-03-07 12:25:40 -0800
committerZac Medico <zmedico@gentoo.org>2020-03-07 12:28:50 -0800
commitc1b19c2415c2f85074634da0c29350d905188c6f (patch)
tree8033929ea15054adbbba1b866949f5c091b1cfff /lib/portage
parentAsynchronousTask: simplify isAlive (bug 711688) (diff)
downloadportage-c1b19c2415c2f85074634da0c29350d905188c6f.tar.gz
portage-c1b19c2415c2f85074634da0c29350d905188c6f.tar.bz2
portage-c1b19c2415c2f85074634da0c29350d905188c6f.zip
AsynchronousTask: handle addStartListener after exit (bug 711322)
When addStartListener is called after the task has already exited with a returncode, immediately schedule the listener to be invoked via call_soon. This behavior is similar to the Future add_done_callback method (and addExitListener since commit 5d476c4e5002). Signed-off-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'lib/portage')
-rw-r--r--lib/portage/tests/util/futures/test_done_callback_after_exit.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/portage/tests/util/futures/test_done_callback_after_exit.py b/lib/portage/tests/util/futures/test_done_callback_after_exit.py
index 46a51c271..8913d70e5 100644
--- a/lib/portage/tests/util/futures/test_done_callback_after_exit.py
+++ b/lib/portage/tests/util/futures/test_done_callback_after_exit.py
@@ -36,5 +36,9 @@ class DoneCallbackAfterExitTestCase(TestCase):
for i in range(3):
event = loop.create_future()
+ task.addStartListener(lambda task: event.set_result(None))
+ loop.run_until_complete(event)
+
+ event = loop.create_future()
task.addExitListener(lambda task: event.set_result(None))
loop.run_until_complete(event)