IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/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. /max/get-started.md).

Mojo struct

ConsumeContext

struct ConsumeContext[pipeline_origin: MutOrigin, num_stages: Int]

Context manager for consuming one pipeline stage.

  • enter: Waits for producer to be ready, returns ref to stage
  • exit: Releases the stage (signals consumption + advances)

Fields​

  • ​pipeline (Pointer[ProducerConsumerPipeline[num_stages], pipeline_origin]):

Implemented traits​

AnyType, ImplicitlyDeletable

Methods​

__init__​

def __init__(out self, pipeline: Pointer[ProducerConsumerPipeline[num_stages], pipeline_origin])

__enter__​

def __enter__(mut self) -> ref[self._stage._value] ConsumerStage[pipeline_origin, num_stages]

Wait for producer and return reference to stage.

Returns:

ref[self._stage._value] ConsumerStage[pipeline_origin, num_stages]

__exit__​

def __exit__(mut self)

Release the stage (signals consumption + advances).