spdl.io.run_async

async run_async(
func: Callable[[...], T],
*args,
_executor: ThreadPoolExecutor | None = None,
**kwargs
) T[source]

Run the given synchronous function asynchronously (in a thread).

Note

To achieve the true concurrency, the function must be thread-safe and must release the GIL.

Parameters:
  • func – The function to run.

  • args – Positional arguments to the func.

  • _executor – Custom executor. If None the default executor of the current event loop is used.

  • kwargs – Keyword arguments to the func.