summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_multiprocessing.py
diff options
context:
space:
mode:
authorRichard Oudkerk <shibturn@gmail.com>2012-06-15 18:18:30 (GMT)
committerRichard Oudkerk <shibturn@gmail.com>2012-06-15 18:18:30 (GMT)
commit0f52346e760648a83504b1babd2a530f802eb096 (patch)
tree93c42dad2d2cd50fc6ca2ec080734dfb7ecbe068 /Lib/test/test_multiprocessing.py
parenta717d563d0807b4c95231fcebfd3fd7b5d567c26 (diff)
downloadcpython-0f52346e760648a83504b1babd2a530f802eb096.zip
cpython-0f52346e760648a83504b1babd2a530f802eb096.tar.gz
cpython-0f52346e760648a83504b1babd2a530f802eb096.tar.bz2
Fix for 2d2f206d040e so that test_multiprocessing does not depend on ctypes
Diffstat (limited to 'Lib/test/test_multiprocessing.py')
-rw-r--r--Lib/test/test_multiprocessing.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py
index 6da5574..e4031f6 100644
--- a/Lib/test/test_multiprocessing.py
+++ b/Lib/test/test_multiprocessing.py
@@ -1109,9 +1109,13 @@ class Bunch(object):
self.n = n
self.started = namespace.DummyList()
self.finished = namespace.DummyList()
- self._can_exit = namespace.Value('i', not wait_before_exit)
+ self._can_exit = namespace.Event()
+ if not wait_before_exit:
+ self._can_exit.set()
for i in range(n):
- namespace.Process(target=self.task).start()
+ p = namespace.Process(target=self.task)
+ p.daemon = True
+ p.start()
def task(self):
pid = os.getpid()
@@ -1120,8 +1124,8 @@ class Bunch(object):
self.f(*self.args)
finally:
self.finished.append(pid)
- while not self._can_exit.value:
- _wait()
+ self._can_exit.wait(30)
+ assert self._can_exit.is_set()
def wait_for_started(self):
while len(self.started) < self.n:
@@ -1132,7 +1136,7 @@ class Bunch(object):
_wait()
def do_finish(self):
- self._can_exit.value = True
+ self._can_exit.set()
class AppendTrue(object):