diff options
| author | Richard Oudkerk <shibturn@gmail.com> | 2013-04-17 21:09:38 +0100 |
|---|---|---|
| committer | Richard Oudkerk <shibturn@gmail.com> | 2013-04-17 21:09:38 +0100 |
| commit | b147f60a3840e59ded58a7cb4a9db1305743302a (patch) | |
| tree | 84a083db6ad5956e653182722a2e7d4a69bf4eb8 /Lib/multiprocessing | |
| parent | c149902175801a448dea3b8c2fa3f496116ce311 (diff) | |
| parent | 409c31390f839debb2f05cef691e8b59e52bd524 (diff) | |
| download | cpython-git-b147f60a3840e59ded58a7cb4a9db1305743302a.tar.gz | |
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 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): |
