File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -775,8 +775,11 @@ class BrokenBarrierError(RuntimeError):
775775def _newname (name_template ):
776776 return name_template % _counter ()
777777
778- # Active thread administration
779- _active_limbo_lock = _allocate_lock ()
778+ # Active thread administration.
779+ #
780+ # bpo-44422: Use a reentrant lock to allow reentrant calls to functions like
781+ # threading.enumerate().
782+ _active_limbo_lock = RLock ()
780783_active = {} # maps thread id to Thread object
781784_limbo = {}
782785_dangling = WeakSet ()
@@ -1564,7 +1567,7 @@ def _after_fork():
15641567 # by another (non-forked) thread. http://bugs.python.org/issue874900
15651568 global _active_limbo_lock , _main_thread
15661569 global _shutdown_locks_lock , _shutdown_locks
1567- _active_limbo_lock = _allocate_lock ()
1570+ _active_limbo_lock = RLock ()
15681571
15691572 # fork() only copied the current thread; clear references to others.
15701573 new_active = {}
Original file line number Diff line number Diff line change 1+ The :func: `threading.enumerate ` function now uses a reentrant lock to
2+ prevent a hang on reentrant call.
3+ Patch by Victor Stinner.
You can’t perform that action at this time.
0 commit comments