Skip to content

tenzr::execution::StreamEventState

Shared readiness state for a stream event, holding the ready flag, the PJRT event, and completion callbacks.

#include <stream.h>

Public Functions

Name
void SetReady()
Mark the event ready and dispatch registered callbacks.
void Wait()
Block until the event is ready.
bool IsReady() const
Check readiness without blocking.
void AddCallback(std::function< void()> cb)
Register a callback to run on completion.

Public Attributes

Name
std::atomic< bool > ready
std::mutex mutex
std::condition_variable cv
std::vector< std::function< void()> > callbacks
Callbacks invoked on completion.
PJRT_Event * pjrt_event

Public Functions Documentation

function SetReady

void SetReady()

Mark the event ready and dispatch registered callbacks.

Mark the event ready and run all registered callbacks.

function Wait

void Wait()

Block until the event is ready.

Block until the event becomes ready.

function IsReady

bool IsReady() const

Check readiness without blocking.

Return: true when ready.

Whether the event has already fired.

function AddCallback

void AddCallback(
    std::function< void()> cb
)

Register a callback to run on completion.

Parameters:

  • cb Callback to run on readiness.

Register a callback, invoking it immediately when the event is already ready.

Public Attributes Documentation

variable ready

std::atomic< bool > ready {false};

variable mutex

std::mutex mutex;

variable cv

std::condition_variable cv;

variable callbacks

std::vector< std::function< void()> > callbacks;

Callbacks invoked on completion.

variable pjrt_event

PJRT_Event * pjrt_event {nullptr};