docs: add class docstring to _LoopWrapper (#27870)
Document the purpose of the daemon thread that backs the sync branch of the timeout decorator. Co-authored-by: oss-agent-shin <279349115+oss-agent-shin@users.noreply.github.com>
This commit is contained in:
parent
ca82761e48
commit
714664fe21
@ -90,6 +90,13 @@ def timeout(timeout_duration: float = 0.0, exception_to_raise=Timeout):
|
||||
|
||||
|
||||
class _LoopWrapper(Thread):
|
||||
"""Daemon thread that owns a dedicated asyncio event loop.
|
||||
|
||||
Used by the sync branch of :func:`timeout` to run a coroutine on a
|
||||
background event loop so the calling thread can wait on it with a
|
||||
timeout via :func:`asyncio.run_coroutine_threadsafe`.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(daemon=True)
|
||||
self.loop = asyncio.new_event_loop()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user