]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40221: Update multiprocessing to use _at_fork_reinit (GH-19477)
authorDong-hee Na <donghee.na92@gmail.com>
Tue, 14 Apr 2020 13:15:52 +0000 (22:15 +0900)
committerGitHub <noreply@github.com>
Tue, 14 Apr 2020 13:15:52 +0000 (22:15 +0900)
Lib/multiprocessing/util.py

index 32c7a96d2534d94cd781a8bfb3ef9e7c0b84ca5b..21f2a7ebe250028c97ccf1befa2e769e44bb42de 100644 (file)
@@ -367,13 +367,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._at_fork_reinit)
+
+    def _at_fork_reinit(self):
+        self._lock._at_fork_reinit()
 
     def __enter__(self):
         return self._lock.__enter__()