IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: Nightly
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

create_task

create_task(var handle: Coroutine, out task: Task[handle.type, handle.origins])

Run the coroutine as a task on the AsyncRT Runtime.

This function creates a task from a coroutine and schedules it for execution on the async runtime. The task will execute asynchronously without blocking the current execution context.

Args:

  • handle (Coroutine): The coroutine to execute as a task. Ownership is transferred.

Returns:

Task[handle.type, handle.origins]: The task output parameter is initialized with the created task.