From: Richard Oudkerk Date: Fri, 15 Jun 2012 18:18:30 +0000 (+0100) Subject: Fix for 2d2f206d040e so that test_multiprocessing does not depend on ctypes X-Git-Tag: v3.3.0b1~237^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0f52346e760648a83504b1babd2a530f802eb096;p=thirdparty%2FPython%2Fcpython.git Fix for 2d2f206d040e so that test_multiprocessing does not depend on ctypes --- diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py index 6da55749b693..e4031f692775 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):