dma_fence_wait_any_timeout(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… dma_fence_wait_any_timeout(9) β€” from the Kernel API Manual, bestie

okay so picture this: you're out here with a whole array of fences and you just wanna sleep until literally any one of them gets signaled, or until the timeout runs out. that's it. that's the function. no cap.


✨ NAME ✨

dma_fence_wait_any_timeout β€” sleep until any fence gets signaled or until timeout elapses πŸŒ™πŸ’€


πŸŽ€ SYNOPSIS πŸŽ€

signed long dma_fence_wait_any_timeout (struct dma_fence **fences ,
uint32_t count , bool intr , signed long timeout , uint32_t *idx );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • fences β€” array of fences to wait on. yes, an array, she's a group activity bestie πŸ’…
  • count β€” number of fences to wait on. gotta tell her how many girlies are in the lineup ✨
  • intr β€” if true, do an interruptible wait 😴 you can be woken up early, main character energy
  • timeout β€” timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT ⏰ the "wait basically forever" option, iykyk
  • idx β€” used to store the first signaled fence index, meaningful only on positive return πŸ‘‘ lowkey only useful if things actually went well

🌸 DESCRIPTION 🌸

so here's what she returns, and the vibes are very different depending on how it goes:

  • -EINVAL on custom fence wait implementation πŸ™ˆ nope, not supported
  • -ERESTARTSYS if interrupted 😭 rude, but okay
  • 0 if the wait timed out πŸ’€ nothing happened, bestie
  • the remaining timeout in jiffies on success ✨ we love a positive outcome

she does synchronous waits for the first fence in the array to be signaled. the way that this is *synchronous*… no async games here, we're waiting fr fr.

⚠️ the caller needs to hold a reference to all fences in the array, otherwise a fence might be freed before return, resulting in undefined behavior. this is the important part bestie, do NOT skip it β€” undefined behavior is not cute and it does NOT slay πŸ’…πŸ”₯

see also dma_fence_wait and dma_fence_wait_timeout 🫢


πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./drivers/dma-buf/dma-fence.c, plus the whole friend group:


and that's the whole page, bestie πŸŽ€ she lives in ./drivers/dma-buf, dated October 2026, shipped with the Kernel API Manual β€” go forth and wait on your fences responsibly, ily πŸ«ΆπŸ’–

πŸ“¦ where this page comes from