commit:     62b0dc613d7d8eb099231bc4cb7303a0abdaf480
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Mar  5 16:25:45 2020 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Mar  5 16:31:04 2020 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=62b0dc61

AsynchronousTask: schedule start listeners via call_soon (bug 711322)

Schedule start listeners via call_soon, in order to avoid callback races
like the SequentialTaskQueue exit listener race that triggered bug
711322. Callbacks scheduled via call_soon are placed in a fifo queue,
ensuring that they execute in an order that is unsurprising relative to
other callbacks.

Bug: https://bugs.gentoo.org/711322
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 lib/_emerge/AsynchronousTask.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/_emerge/AsynchronousTask.py b/lib/_emerge/AsynchronousTask.py
index 580eef050..1b450e3b0 100644
--- a/lib/_emerge/AsynchronousTask.py
+++ b/lib/_emerge/AsynchronousTask.py
@@ -167,7 +167,7 @@ class AsynchronousTask(SlotObject):
                        self._start_listeners = None
 
                        for f in start_listeners:
-                               f(self)
+                               self.scheduler.call_soon(f, self)
 
        def addExitListener(self, f):
                """

Reply via email to