Skip to main content

TimelineSignal

Trait TimelineSignal 

Source
pub trait TimelineSignal:
    Send
    + Sync
    + Debug {
    // Required methods
    fn value(&self) -> u64;
    fn set(&self, value: u64);
    fn wait(&self, value: u64, timeout_ms: u64) -> Result<()>;

    // Provided method
    fn is_reached(&self, value: u64) -> bool { ... }
}
Expand description

Monotonic timeline signal for synchronization.

Timeline signals provide a way to order operations across different execution contexts (threads, devices, queues). The signal value only increases, and waiters block until the signal reaches or exceeds the target value.

§Thread Safety

All implementations must be Send + Sync for cross-thread use.

Required Methods§

Source

fn value(&self) -> u64

Get the current signal value.

Source

fn set(&self, value: u64)

Set the signal to a new value.

§Panics

May panic if value is less than the current value (implementation-defined).

Source

fn wait(&self, value: u64, timeout_ms: u64) -> Result<()>

Wait for the signal to reach or exceed value.

§Arguments
  • value - The target value to wait for
  • timeout_ms - Maximum time to wait in milliseconds (0 = infinite)
§Returns

Ok(()) if the signal reached the target value, or Err on timeout.

Provided Methods§

Source

fn is_reached(&self, value: u64) -> bool

Check if the signal has reached value without blocking.

Implementors§