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
Trueif all tasks have completed and the stream is synchronized. ReturnsFalseif synchronization is still in progress. Calltry_sync()again later until it returnsTrue.- 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