try_sync

Stream.try_sync()

Tries to synchronize the stream without blocking.

This function returns immediately without waiting for pending tasks. It initiates a background synchronization if one is not already in progress. Users should repeatedly call this function in a loop until it returns True.

Returns:

Returns True if all tasks have completed and the stream is synchronized. Returns False if synchronization is still in progress. Call try_sync() again later until it returns True.

Return type:

bool

Examples

>>> # Run inference
>>> module.run(inputs)
>>> # Wait for completion by polling try_sync()
>>> while not stream.try_sync():
...     time.sleep(0.001)  # Sleep 1ms between checks