diff options
author | Richard Oudkerk <shibturn@gmail.com> | 2013-04-17 18:15:52 (GMT) |
---|---|---|
committer | Richard Oudkerk <shibturn@gmail.com> | 2013-04-17 18:15:52 (GMT) |
commit | 7bdd93c20e2751420a4a51d019f6887e972d783e (patch) | |
tree | 2a15b9f20b207ee1747e4c1364534e5e12e9d751 /Lib/multiprocessing | |
parent | 90f8b23be293712447a67f41b58e19cd7b803ad5 (diff) | |
download | cpython-7bdd93c20e2751420a4a51d019f6887e972d783e.zip cpython-7bdd93c20e2751420a4a51d019f6887e972d783e.tar.gz cpython-7bdd93c20e2751420a4a51d019f6887e972d783e.tar.bz2 |
Issue #17555: Fix ForkAwareThreadLock so that size of after fork
registry does not grow exponentially with generation of process.
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r-- | Lib/multiprocessing/util.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py index 3ce480f..d1b3d2e 100644 --- a/Lib/multiprocessing/util.py +++ b/Lib/multiprocessing/util.py @@ -329,10 +329,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): |