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).

get_safe_task_id

def get_safe_task_id(ctx: DeviceContext) -> OptionalReg[Int]

Safely extract task_id from DeviceContext, returning None if null/invalid.

Args:

  • ctx (DeviceContext): The device context to extract the task ID from.

Returns:

OptionalReg[Int]: An OptionalReg containing the task ID if valid, None otherwise.

def get_safe_task_id(ctx: Optional[DeviceContext]) -> OptionalReg[Int]

Safely extract task_id from an optional DeviceContext, returning None if the context is absent or invalid.

Args:

Returns:

OptionalReg[Int]: An OptionalReg containing the task ID if ctx is set and the underlying handle is valid, None otherwise.