wait_event_idle_timeout(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’€ wait_event_idle_timeout(9) β€” the kernel API manual, but make it cute

okay so bestie, we're in the Kernel API Manual and today's main character is wait_event_idle_timeout πŸŽ€ like, this is a 9-section manpage, iykyk. Buckle up.


✨ NAME ✨

wait_event_idle_timeout β€” sleep without load until a condition becomes true or a timeout elapses 😴⏰

Literally the whole vibe: you nap (but like, productively) until your thing happens or the clock runs out. No cap.


🌸 SYNOPSIS 🌸

wait_event_idle_timeout (wq_head , condition , timeout );

Three args, that's it, slay. πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • wq_head β€” the waitqueue to wait on πŸ’€ like, this is the line you're queued up in.
  • condition β€” a C expression for the event to wait for ✨ the thing you're manifesting, fr fr.
  • timeout β€” timeout, in jiffies ⏳ yes, jiffies, not seconds, don't come for me.

πŸ’– DESCRIPTION πŸ’–

The process is put to sleep (TASK_IDLE) until the condition evaluates to true πŸ”₯ note the TASK_IDLE β€” that's the "no load" part, so the scheduler isn't mad at you.

The condition is checked each time the waitqueue wq_head is woken up πŸ‘€ every single wakeup = a fresh vibe check on your condition.

⚠️ ok important bestie: wake_up has to be called after changing any variable that could change the result of the wait condition. Like, if you flip the variable and don't call wake_up, nobody knows. the sleeper just keeps sleeping. embarrassing. πŸ’€

πŸ‘‘ RETURN πŸ‘‘

Here's the tea on what you get back:

  • 0 if the condition evaluated to false after the timeout elapsed πŸ™ˆ (timeout hit, condition said no)
  • 1 if the condition evaluated to true after the timeout elapsed 🀨 (timeout hit, but the condition did land true β€” iconic but late)
  • the remaining jiffies (at least 1) if the condition evaluated to true before the timeout elapsed 🌈 (early win! you get the leftover jiffies back, minimum 1)

🧚 SEE ALSO 🧚

All the siblings, and yes there are so many, family reunion energy 🫢

Kernel file ./include/linux/wait.h β€” 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_timeout(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_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 page πŸ’…

shoutout to ./include/linux for housing this whole situation, this version is dated October 2026 ⭐ and the source/version line says ./include/linux + October 2026 + wait_event_idle_timeout(9) β€” so yeah, that's the sign-off, love u, bye πŸ“βœ¨

πŸ“¦ where this page comes from