From 409c31390f839debb2f05cef691e8b59e52bd524 Mon Sep 17 00:00:00 2001 From: Richard Oudkerk Date: Wed, 17 Apr 2013 20:58:00 +0100 Subject: Issue #17555: Fix ForkAwareThreadLock so that size of after fork registry does not grow exponentially with generation of process. --- Lib/multiprocessing/util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Lib/multiprocessing/util.py') diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py index 72385a8fa3..f5862b49a4 100644 --- a/Lib/multiprocessing/util.py +++ b/Lib/multiprocessing/util.py @@ -322,10 +322,13 @@ atexit.register(_exit_function) class ForkAwareThreadLock(object): def __init__(self): + self._reset() + register_after_fork(self, ForkAwareThreadLock._reset) + + def _reset(self): self._lock = threading.Lock() self.acquire = self._lock.acquire self.release = self._lock.release - register_after_fork(self, ForkAwareThreadLock.__init__) class ForkAwareLocal(threading.local): def __init__(self): -- cgit v1.2.1