dma_fence_wait_any_timeout(9)
π 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β iftrue, do an interruptible wait π΄ you can be woken up early, main character energytimeoutβ timeout value in jiffies, orMAX_SCHEDULE_TIMEOUTβ° the "wait basically forever" option, iykykidxβ 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:
-EINVALon custom fence wait implementation π nope, not supported-ERESTARTSYSif interrupted π rude, but okay0if 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:
DMA fences overview(9)fence cross-driver contract(9)dma_fence_get_stub(9)dma_fence_allocate_private_stub(9)dma_fence_context_alloc(9)fence signalling annotation(9)dma_fence_begin_signalling(9)dma_fence_end_signalling(9)dma_fence_signal_timestamp_locked(9)dma_fence_signal_timestamp(9)dma_fence_signal_locked(9)dma_fence_check_and_signal_locked(9)dma_fence_check_and_signal(9)dma_fence_signal(9)dma_fence_wait_timeout(9)dma_fence_release(9)dma_fence_free(9)dma_fence_enable_signaling(9)dma_fence_add_callback(9)dma_fence_get_status(9)dma_fence_remove_callback(9)dma_fence_default_wait(9)deadline hints(9)dma_fence_set_deadline(9)dma_fence_describe(9)dma_fence_init(9)dma_fence_init64(9)dma_fence_driver_name(9)dma_fence_timeline_name(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms