bpo-40221: Update multiprocessing to use _at_fork_reinit (GH-19511)

This commit is contained in:
Dong-hee Na 2020-04-15 01:35:36 +09:00 committed by GitHub
parent e560f90602
commit a5900ecf9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View file

@ -63,7 +63,6 @@ class _ResourceSharer(object):
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 @@ class _ResourceSharer(object):
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