Skip to main content
Version: 2.7

AsyncThread

{"content": ["Class for running an asyncio event loop in a separate thread.\n\nThis allows running asynchronous coroutines from synchronous code by executingthem on an event loop\nthat runs in its own dedicated thread."]}

Index

Methods

close

  • close(timeout): None
  • {"content": ["Close the event loop and its thread gracefully.\n\nThis method cancels all pending tasks, stops the event loop, and waits for the thread to exit.\nIf the thread does not exit within the given timeout, a forced shutdown is attempted.\n", {"


    Parameters

    • timeout: timedelta = timedelta(seconds=60)

    Returns None

run_coro

  • run_coro(coro, timeout): Any
  • {"content": ["Run a coroutine on an event loop running in a separate thread.\n\nThis method schedules the coroutine to run on the event loop and blocks until the coroutine completes\nor the specified timeout is reached.\n", {"


    Parameters

    • coro: Coroutine
    • timeout: timedelta = timedelta(seconds=60)

    Returns Any

Page Options