wait_event_timeout(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’€ 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 πŸ’œ:


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