diff --git a/Lib/multiprocessing/pool.py b/Lib/multiprocessing/pool.py index a545f3c..e76817a 100644 --- a/Lib/multiprocessing/pool.py +++ b/Lib/multiprocessing/pool.py @@ -540,10 +540,17 @@ class Pool(object): self._worker_handler._state = TERMINATE self._terminate() - def join(self): + def is_alive(self): + util.debug('checking worker handler status') + return self._worker_handler.is_alive() + + def join(self, timeout): util.debug('joining pool') assert self._state in (CLOSE, TERMINATE) - self._worker_handler.join() + self._worker_handler.join(timeout=timeout) + if self._worker_handler.is_alive(): + util.debug('pool join timed out') + return self._task_handler.join() self._result_handler.join() for p in self._pool: