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

This commit is contained in:
Dong-hee Na 2020-04-14 22:15:52 +09:00 committed by GitHub
parent 81a7be3fa2
commit e1945307d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View 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__()