wait_event_timeout(9)
π€ wait_event_timeout β the Kernel API Manual (section 9) bestie edition β¨
okay so you're in wait_event_timeout(9) territory, the Kernel API Manual, section 9 β buckle up π
πΈ NAME πΈ
wait_event_timeout β she sleeps until a condition gets true or a timeout elapses π΄β°
β¨ SYNOPSIS β¨
wait_event_timeout (wq_head , condition , timeout );
π«Ά ARGUMENTS π«Ά
wq_headβ the waitqueue you're waiting on, like your group chat but for kernel threads π¬conditionβ a C expression for the event to wait for, aka the thing you're manifesting β¨timeoutβ the timeout, in jiffies (yes, jiffies, not seconds, don't come for me) β³
π DESCRIPTION π
the process is put to sleep β and ngl, TASK_UNINTERRUPTIBLE specifically β until the condition evaluates to true π΄π¦ the condition gets checked each and every time the waitqueue wq_head is woken up. every single time. she's thorough like that π
β οΈ bestie listen β wake_up has to be called after changing any variable that could change the result of the wait condition. it's not optional, it's not a suggestion, it's giving mandatory ππ₯
π RETURN π
0β the condition evaluated to false after the timeout elapsed π (the "womp womp" outcome)1β the condition evaluated to true after the timeout elapsed π (late but she made it)- the remaining jiffies (at least 1) β the condition evaluated to true before the timeout elapsed π₯π (iconic, early, ate)
π¦ SEE ALSO π¦
the kernel file ./include/linux/wait.h is where all this lives, and here's the whole friend group π:
waitqueue_active(9)wq_has_single_sleeper(9)wq_has_sleeper(9)wake_up_pollfree(9)wait_event(9)wait_event_freezable(9)wait_event_cmd(9)wait_event_interruptible(9)wait_event_interruptible_timeout(9)wait_event_hrtimeout(9)wait_event_interruptible_hrtimeout(9)wait_event_idle(9)wait_event_idle_exclusive(9)wait_event_idle_timeout(9)wait_event_idle_exclusive_timeout(9)wait_event_interruptible_locked(9)wait_event_interruptible_locked_irq(9)wait_event_interruptible_exclusive_locked(9)wait_event_interruptible_exclusive_locked_irq(9)wait_event_killable(9)wait_event_state(9)wait_event_killable_timeout(9)wait_event_lock_irq_cmd(9)wait_event_lock_irq(9)wait_event_interruptible_lock_irq_cmd(9)wait_event_interruptible_lock_irq(9)wait_event_interruptible_lock_irq_timeout(9)
and that's the whole vibe check bestie π
this one's from ./include/linux, dated October 2026, and it's literally called wait_event_timeout(9) β slay, go take a nap until your condition's true π§ββοΈβπ
π¦ 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