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

Mojo function

once

def once[Emit: def() -> None & RegisterPassable & ImplicitlyCopyable, params: ContextParams, //](emit: Emit, ctx: Context[params])

CPU: runs emit unconditionally on the cooperative / tiled tiers (one worker per output), or gated on ctx._is_last_block on the split-axis tier (only the last-arriving worker emits).

emit is a value closure (its copy-captured state rides the value).

Parameters:

Args:

  • ​emit (Emit): Callback to run.
  • ​ctx (Context[params]): The dispatch bundle.