File tree 2 files changed +9
-3
lines changed
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -775,8 +775,11 @@ class BrokenBarrierError(RuntimeError):
775
775
def _newname (name_template ):
776
776
return name_template % _counter ()
777
777
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 ()
780
783
_active = {} # maps thread id to Thread object
781
784
_limbo = {}
782
785
_dangling = WeakSet ()
@@ -1564,7 +1567,7 @@ def _after_fork():
1564
1567
# by another (non-forked) thread. http://bugs.python.org/issue874900
1565
1568
global _active_limbo_lock , _main_thread
1566
1569
global _shutdown_locks_lock , _shutdown_locks
1567
- _active_limbo_lock = _allocate_lock ()
1570
+ _active_limbo_lock = RLock ()
1568
1571
1569
1572
# fork() only copied the current thread; clear references to others.
1570
1573
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