bpo-40221: Update multiprocessing to use _at_fork_reinit (GH-19511)
diff --git a/Lib/multiprocessing/resource_sharer.py b/Lib/multiprocessing/resource_sharer.py
index 8d5c990..6607650 100644
--- a/Lib/multiprocessing/resource_sharer.py
+++ b/Lib/multiprocessing/resource_sharer.py
@@ -63,7 +63,6 @@
def __init__(self):
self._key = 0
self._cache = {}
- self._old_locks = []
self._lock = threading.Lock()
self._listener = None
self._address = None
@@ -113,10 +112,7 @@
for key, (send, close) in self._cache.items():
close()
self._cache.clear()
- # If self._lock was locked at the time of the fork, it may be broken
- # -- see issue 6721. Replace it without letting it be gc'ed.
- self._old_locks.append(self._lock)
- self._lock = threading.Lock()
+ self._lock._at_fork_reinit()
if self._listener is not None:
self._listener.close()
self._listener = None