__slots__ = ('path', 'scheduler',) + \
('_imp', '_force_async', '_force_dummy', '_force_process', \
- '_force_thread', '_waiting')
+ '_force_thread')
_use_process_by_default = True
def _imp_exit(self, imp):
# call exit listeners
- if not self._waiting:
- self.wait()
+ self.wait()
def _cancel(self):
if isinstance(self._imp, AsynchronousTask):
def _wait(self):
if self.returncode is not None:
return self.returncode
- self._waiting = True
self.returncode = self._imp.wait()
- self._waiting = False
return self.returncode
def unlock(self):
"""
__slots__ = ("background", "cancelled", "returncode") + \
- ("_exit_listeners", "_exit_listener_stack", "_start_listeners")
+ ("_exit_listeners", "_exit_listener_stack", "_start_listeners",
+ "_waiting")
def start(self):
"""
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