summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-04-07 21:11:49 (GMT)
committerGitHub <noreply@github.com>2020-04-07 21:11:49 (GMT)
commit87255be6964979b5abdc4b9dcf81cdcfdad6e753 (patch)
tree30f3c5a680dd7ed6435841ecd38166de7654503e /Misc
parent48b069a003ba6c684a9ba78493fbbec5e89f10b8 (diff)
downloadcpython-87255be6964979b5abdc4b9dcf81cdcfdad6e753.zip
cpython-87255be6964979b5abdc4b9dcf81cdcfdad6e753.tar.gz
cpython-87255be6964979b5abdc4b9dcf81cdcfdad6e753.tar.bz2
bpo-40089: Add _at_fork_reinit() method to locks (GH-19195)
Add a private _at_fork_reinit() method to _thread.Lock, _thread.RLock, threading.RLock and threading.Condition classes: reinitialize the lock after fork in the child process; reset the lock to the unlocked state. Rename also the private _reset_internal_locks() method of threading.Event to _at_fork_reinit(). * Add _PyThread_at_fork_reinit() private function. It is excluded from the limited C API. * threading.Thread._reset_internal_locks() now calls _at_fork_reinit() on self._tstate_lock rather than creating a new Python lock object.
Diffstat (limited to 'Misc')
-rw-r--r--Misc/NEWS.d/next/Library/2020-03-27-16-54-29.bpo-40089.VTq_8s.rst6
1 files changed, 6 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2020-03-27-16-54-29.bpo-40089.VTq_8s.rst b/Misc/NEWS.d/next/Library/2020-03-27-16-54-29.bpo-40089.VTq_8s.rst
new file mode 100644
index 0000000..3948852
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-03-27-16-54-29.bpo-40089.VTq_8s.rst
@@ -0,0 +1,6 @@
+Add a private ``_at_fork_reinit()`` method to :class:`_thread.Lock`,
+:class:`_thread.RLock`, :class:`threading.RLock` and
+:class:`threading.Condition` classes: reinitialize the lock at fork in the
+child process, reset the lock to the unlocked state.
+Rename also the private ``_reset_internal_locks()`` method of
+:class:`threading.Event` to ``_at_fork_reinit()``.