wait_for_com...able_timeout(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… wait_for_com...able_timeout(9) β€” the Kernel API Manual, bestie edition

okay so this is a page straight out of the Kernel API Manual, and the star of the show is wait_for_completion_killable_timeout. yes the title is abbreviated with ... in the header, yes that's just how it is, no we're not fixing it, it's iconic. πŸŽ€


✨ NAME ✨

wait_for_completion_killable_timeout β€” literally just waits for completion of a task (w/(to,killable)), and yeah that parenthetical is the whole vibe: with timeout, and killable. periodt. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

long wait_for_completion_killable_timeout (struct completion *x ,
unsigned long timeout );

that's it. two args. you got this, i believe in you. 🫢


🌸 ARGUMENTS 🌸

  • x β€” holds the state of this particular completion. it's the lil completion struct keeping track of everything, main character energy fr. πŸ‘‘
  • timeout β€” the timeout value, and ngl it's in jiffies. not seconds, not millis, jiffies. remember that, it matters. ⭐

πŸ”₯ DESCRIPTION πŸ”₯

so this one waits for either a completion of a specific task to be signaled or for a specified timeout to expire β€” whichever comes first, bestie. race conditions are quaking. 🌈

the tea: it can be interrupted by a kill signal. so like, it's not stubborn, it'll let go if something kill-y comes knocking.

and once more for the people in the back: the timeout is in jiffies. πŸ’€ don't come crying to me when you pass milliseconds.


πŸ’– RETURN πŸ’–

here's the vibe check on return values, memorize these:

  • -ERESTARTSYS β€” if interrupted. rude, but okay. 😭
  • 0 β€” if timed out. it waited, nothing happened, we move on.
  • positive (at least 1, or number of jiffies left till timeout) β€” if completed. slay! and note bestie, that positive number is at least 1, or the number of jiffies left till timeout. both. that's the deal. ✨

🧚 SEE ALSO 🧚

okay this is the friend group, the whole squad, the completion.c cinematic universe β€” all living in the kernel file ./kernel/sched/completion.c:

iykyk. go read them all, i'll wait. πŸ“


quick reminder bestie: <pink>killable</pink> means a kill signal can break you out of this wait, and the whole timeout situation is in jiffies β€” that's not a suggestion, that's the API. πŸ™ˆ

and that's the page!! πŸ’œ this lil slice of manual lives under ./kernel/sched, dated October 2026, and yeah β€” that's the source, that's the version, that's the footer. mwah. πŸ’…πŸŽ€

πŸ“¦ where this page comes from