summaryrefslogtreecommitdiffstats
path: root/pym/_emerge/AsynchronousTask.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-02-06 18:52:32 -0800
committerZac Medico <zmedico@gentoo.org>2012-02-07 11:12:11 -0800
commit839f369f259a7c019c1f544bf4c153058355f6d4 (patch)
treea4f1a63e233d8b35c4883c90df3e076bd3770c05 /pym/_emerge/AsynchronousTask.py
parente9d1125f6730c85c4b384a580da55da68338acf1 (diff)
downloadportage-839f369f259a7c019c1f544bf4c153058355f6d4.tar.gz
portage-839f369f259a7c019c1f544bf4c153058355f6d4.tar.bz2
portage-839f369f259a7c019c1f544bf4c153058355f6d4.zip
AsynchronousTask: merge _waiting from subclass
Diffstat (limited to 'pym/_emerge/AsynchronousTask.py')
-rw-r--r--pym/_emerge/AsynchronousTask.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/pym/_emerge/AsynchronousTask.py b/pym/_emerge/AsynchronousTask.py
index 36522ca4c..4aa598085 100644
--- a/pym/_emerge/AsynchronousTask.py
+++ b/pym/_emerge/AsynchronousTask.py
@@ -14,7 +14,8 @@ class AsynchronousTask(SlotObject):
"""
__slots__ = ("background", "cancelled", "returncode") + \
- ("_exit_listeners", "_exit_listener_stack", "_start_listeners")
+ ("_exit_listeners", "_exit_listener_stack", "_start_listeners",
+ "_waiting")
def start(self):
"""
@@ -42,7 +43,12 @@ class AsynchronousTask(SlotObject):
def wait(self):
if self.returncode is None:
- self._wait()
+ if not self._waiting:
+ self._waiting = True
+ try:
+ self._wait()
+ finally:
+ self._waiting = False
self._wait_hook()
return self.returncode