diff options
-rw-r--r-- | Lib/asyncio/unix_events.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index 28fb491864..19d713545e 100644 --- a/Lib/asyncio/unix_events.py +++ b/Lib/asyncio/unix_events.py @@ -1344,7 +1344,14 @@ class ThreadedChildWatcher(AbstractChildWatcher): return True def close(self): - pass + self._join_threads() + + def _join_threads(self): + """Internal: Join all non-daemon threads""" + threads = [thread for thread in list(self._threads.values()) + if thread.is_alive() and not thread.daemon] + for thread in threads: + thread.join() def __enter__(self): return self |