Skip to main content

wait_deadline

Function wait_deadline 

Source
pub fn wait_deadline(timeout: Duration) -> Option<Instant>
Expand description

The absolute deadline a wait(timeout) poll loop should honour, or None for the SyncWaiter::wait contract’s Duration::MAX “wait forever” sentinel.

  • timeout == Duration::MAX → None: the caller asked to wait forever, so the loop runs with no deadline (matching every backend’s explicit Duration::MAX handling, which maps to the native “infinite”: vkWaitSemaphores(UINT64_MAX), WaitForSingleObject(INFINITE), cuEventSynchronize, …).
  • any other timeout → Some(now + timeout), saturated to a bounded, always-representable Instant on Instant + Duration overflow — clamped to now + 1 year, far beyond any real GPU wait budget.

This keeps the two meanings of “no deadline” distinct: a returned None encodes ONLY the explicit forever sentinel, never an accidental checked_add overflow — which would otherwise silently convert a bounded wait into an unbounded hang.