Skip to main content

Mojo struct

ProduceContext

struct ProduceContext[pipeline_origin: MutOrigin, num_stages: Int]

Context manager for producing one pipeline stage.

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

Note: The actual production signal (mma_arrive) is kernel-specific and must be called by the user before exiting the context.

Fields

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

Implemented traits

AnyType, ImplicitlyDestructible

comptime members

__del__is_trivial

comptime __del__is_trivial = _all_trivial_del[_NoneType, ProducerStage[pipeline_origin, num_stages]]()

Methods

__init__

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

__enter__

__enter__(mut self) -> ref[origin_of(*[0,0]._stage._value)] ProducerStage[pipeline_origin, num_stages]

Wait for consumer and return reference to stage.

Returns:

ref

__exit__

__exit__(mut self)

Release the stage (advances producer).

Was this page helpful?