diff options
authorZac Medico <zmedico@gentoo.org>2020-03-22 17:19:27 -0700
committerZac Medico <zmedico@gentoo.org>2020-03-22 17:41:36 -0700
commit21aea3df73497184c5c94fd6c69ebe23f3d214e9 (patch)
treee7527c8ae42abbd0efc236ceecea771cfea38331 /lib/_emerge/AsynchronousTask.py
parentAsynchronousTask: include self in InvalidStateError message (diff)
AsynchronousTask: in _async_wait, call self.wait() immediately
In _async_wait, call self.wait() immediately so that the stack trace for an InvalidStateError will contain useful debugging information. Since commit 46903f3e5622, exit listeners are invoked via call_soon, so it's no longer unecessary for _async_wait to invoke self.wait() via call_soon. Signed-off-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'lib/_emerge/AsynchronousTask.py')
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/_emerge/AsynchronousTask.py b/lib/_emerge/AsynchronousTask.py
index aaab7433a..c4197d468 100644
--- a/lib/_emerge/AsynchronousTask.py
+++ b/lib/_emerge/AsynchronousTask.py
@@ -109,13 +109,13 @@ class AsynchronousTask(SlotObject):
def _async_wait(self):
- For cases where _start exits synchronously, this method is a
- convenient way to trigger an asynchronous call to self.wait()
- (in order to notify exit listeners), avoiding excessive event
- loop recursion (or stack overflow) that synchronous calling of
- exit listeners can cause. This method is thread-safe.
+ Subclasses call this method in order to invoke exit listeners when
+ self.returncode is set. Subclasses may override this method in order
+ to perform cleanup. The default implementation for this method simply
+ calls self.wait(), which will immediately raise an InvalidStateError
+ if the event loop is running and self.returncode is None.
- self.scheduler.call_soon(self.wait)
+ self.wait()
def cancel(self):