wait_for_com...able_timeout(9)
π 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:
complete(9)complete_all(9)wait_for_completion(9)wait_for_completion_timeout(9)wait_for_completion_io(9)wait_for_completion_io_timeout(9)wait_for_completion_interruptible(9)wait_for_completion_interruptible_timeout(9)wait_for_completion_killable(9)try_wait_for_completion(9)completion_done(9)
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
- 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