Skip to main content

Mojo struct

WaitAndAdvanceHandle

struct WaitAndAdvanceHandle[work_origin: MutOrigin]

RAII handle for waiting on CLC barrier and advancing work iterator.

Uses the origin system (init/del) instead of context managers. The current work_info is captured on construction. On destruction, the prefetched next work is written back to the iterator's work_info.

Usage: var handle = work_iter.wait_and_advance_linear() process(handle.work_info) handle^.release() # After release, work_iter.work_info is the NEXT work item

Fields​

  • ​work_info (WorkInfo):
  • ​work_info_ptr (Pointer[WorkInfo, work_origin]):
  • ​next_work (WorkInfo):

Implemented traits​

AnyType, ImplicitlyDestructible

Methods​

__init__​

__init__(out self, work_info_ptr: Pointer[WorkInfo, work_origin], next_work: WorkInfo)

release​

release(deinit self)

Release the handle and advance to next work.