summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/multiprocessing/managers.py5
-rw-r--r--Lib/test/test_multiprocessing.py3
2 files changed, 7 insertions, 1 deletions
diff --git a/Lib/multiprocessing/managers.py b/Lib/multiprocessing/managers.py
index f47402a..dc8166a 100644
--- a/Lib/multiprocessing/managers.py
+++ b/Lib/multiprocessing/managers.py
@@ -548,7 +548,10 @@ class BaseManager(object):
'''
Join the manager process (if it has been spawned)
'''
- self._process.join(timeout)
+ if self._process is not None:
+ self._process.join(timeout)
+ if not self._process.is_alive():
+ self._process = None
def _debug_info(self):
'''
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py
index 792db25..4a74e87 100644
--- a/Lib/test/test_multiprocessing.py
+++ b/Lib/test/test_multiprocessing.py
@@ -2516,6 +2516,7 @@ class TestInitializers(unittest.TestCase):
def tearDown(self):
self.mgr.shutdown()
+ self.mgr.join()
def test_manager_initializer(self):
m = multiprocessing.managers.SyncManager()
@@ -2523,6 +2524,7 @@ class TestInitializers(unittest.TestCase):
m.start(initializer, (self.ns,))
self.assertEqual(self.ns.test, 1)
m.shutdown()
+ m.join()
def test_pool_initializer(self):
self.assertRaises(TypeError, multiprocessing.Pool, initializer=1)
@@ -2818,6 +2820,7 @@ def test_main(run=None):
ManagerMixin.pool.terminate()
ManagerMixin.pool.join()
ManagerMixin.manager.shutdown()
+ ManagerMixin.manager.join()
ThreadsMixin.pool.join()
ProcessesMixin.pool.join()
del ProcessesMixin.pool, ThreadsMixin.pool, ManagerMixin.pool