summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing
diff options
context:
space:
mode:
authorRichard Oudkerk <shibturn@gmail.com>2013-04-17 19:58:00 (GMT)
committerRichard Oudkerk <shibturn@gmail.com>2013-04-17 19:58:00 (GMT)
commit409c31390f839debb2f05cef691e8b59e52bd524 (patch)
tree49a505458425a31be4c08e22c38c8c56c17d8992 /Lib/multiprocessing
parentb38897fc91c7f4b80bc2025ade219674d7b78bf3 (diff)
downloadcpython-409c31390f839debb2f05cef691e8b59e52bd524.zip
cpython-409c31390f839debb2f05cef691e8b59e52bd524.tar.gz
cpython-409c31390f839debb2f05cef691e8b59e52bd524.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.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py
index 72385a8..f5862b4 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):