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 struct

Ring

struct Ring[depth: Int, producers: Int, consumers: Int]

One side's cursor over a ring of depth slots whose FULL count each of producers waves and EMPTY count each of consumers waves add 1 to per trip.

Fields​

  • ​words (LPtr[UInt32]):
  • ​trip (Int):

Implemented traits​

AnyType, Deinitable, Movable

Methods​

__init__​

def __init__(out self, words: LPtr[UInt32], word: Int)

acquire​

def acquire(mut self) -> Int

The producer's slot for this trip, once its consumers freed it.

Returns:

Int

commit​

def commit(mut self)

wait​

def wait(mut self) -> Int

The consumer's slot for this trip, once its producers filled it.

Returns:

Int

release​

def release(mut self)

Was this page helpful?