wait_event_i...ible_timeout(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’€ wait_event_i...ible_timeout(9) β€” the Kernel API Manual tea, bestie ✨

Okay so real talk, the page header literally says wait_event_i...ible_timeout(9) from the Kernel API Manual, and that's our whole main character for today. Buckle up, we're going to sleep (but like, interruptibly πŸ’…).


🌸 NAME 🌸

wait_event_interruptible_timeout β€” she sleeps until a condition gets true or a timeout elapses. Whichever comes first, queen behavior fr fr.


✨ SYNOPSIS ✨

wait_event_interruptible_timeout (wq_head , condition , timeout );

πŸŽ€ ARGUMENTS πŸŽ€

  • wq_head β€” the waitqueue to wait on. Like, this is the group chat you're lurking in πŸ‘€
  • condition β€” a C expression for the event to wait for. The "am I unblocked yet?" vibe check ✨
  • timeout β€” timeout, in jiffies. Yes bestie, jiffies. Not seconds. Not vibes. Jiffies πŸ•°οΈ

πŸ¦‹ DESCRIPTION πŸ¦‹

So what actually happens: the process gets put to sleep β€” and ngl, she's in TASK_INTERRUPTIBLE mode, which is the fancy way of saying "asleep but still answering texts" β€” until the condition evaluates to true or a signal is received πŸ’–

The condition gets checked each and every time the waitqueue wq_head is woken up. Every single time. Not me refreshing the timeline πŸ“±

⚠️ Warning bestie, this one matters: wake_up has to be called after changing any variable that could change the result of the wait condition. Skip that and you're literally ghosting your own waitqueue πŸ’€

πŸ”₯ RETURN πŸ”₯

Here's the receipts, and yes, every single one:

  • 0 β€” if the condition evaluated to false after the timeout elapsed 🫠
  • 1 β€” if the condition evaluated to true after the timeout elapsed πŸŽ‰
  • the remaining jiffies (at least 1) β€” if the condition evaluated to true before the timeout elapsed ⏳ (and yes, at least 1, they said what they said)
  • -ERESTARTSYS β€” if it was interrupted by a signal 😭 rude but okay

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./include/linux/wait.h, and literally the entire waitqueue friend group β€” slay:


Okay that's the whole page bestie, no cap, nothing skipped πŸ’– This icon lives at ./include/linux, dated October 2026, and its manual tag is forever wait_event_i...ible_timeout(9) β€” periodt πŸ«Άβœ¨πŸŽ€

πŸ“¦ where this page comes from