wait_event_i...le_hrtimeout(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’€ wait_event_interruptible_hrtimeout(9) β€” like, the Kernel API Manual one πŸ’€

okay bestie, so this is a kernel API manual page and the function we're obsessing over is wait_event_interruptible_hrtimeout. it lives in the Kernel API Manual, section 9. yes, the driver/kernel section. we're in the big leagues now πŸŽ€


✨ NAME ✨

wait_event_interruptible_hrtimeout β€” sleep until a condition gets true or a timeout elapses

like, it literally naps your process until something happens or the clock runs out. nap with a deadline. iconic. πŸ¦‹


πŸ“œ SYNOPSIS πŸ“œ

wait_event_interruptible_hrtimeout (wq , condition , timeout );

(yes, the spacing is exactly like that, don't @ me, that's how the manpage has it πŸ’…)


🌸 ARGUMENTS 🌸

  • wq β€” the waitqueue to wait on. this is the little queue your sleepy process is gonna be chilling in πŸ›Œ
  • condition β€” a C expression for the event to wait for. it's just an expression, bestie, it gets evaluated for truthiness ✨
  • timeout β€” the timeout, as a ktime_t. so it's the high-resolution kind of timeout, not the janky old-school one πŸ”₯

πŸ’– DESCRIPTION πŸ’–

so here's the vibe check: the process gets put to sleep in TASK_INTERRUPTIBLE state until the condition evaluates to true or a signal is received 😴✨

the condition gets checked every single time the waitqueue wq is woken up. every time. no skipping. she's thorough πŸ’…

⚠️ okay this part matters, no cap: wake_up has to be called after changing any variable that could change the result of the wait condition. if you forget, you're gonna be waiting forever and that is not the main character energy you want πŸ™ˆ

and the return values, because obviously we need to know how she comes back:

  • 0 β€” the condition became true, we love a happy ending πŸ₯³
  • -ERESTARTSYS β€” it was interrupted by a signal πŸ›‘
  • -ETIME β€” the timeout elapsed, time's up babe ⏰

three possible exits, all valid, all documented, all slay πŸ’€


πŸ”— SEE ALSO πŸ”—

this function lives in the kernel file ./include/linux/wait.h β€” that's the address, bestie 🏠 and honestly the whole wait-event friend group showed up for this one, they're all here:

^^ that's the entire wait_event family reunion and every one of them ate 🫢 go read them if you're nosy, i support it 🧚


🌈 that's the whole page, bestie β€” every flag, every argument, every return code, every single reference. nothing skipped. periodt. πŸ‘‘

and a cute little sign-off for the credits: this page comes to you from ./include/linux, dated October 2026. future vibes only πŸ’œβ­πŸ“

πŸ“¦ where this page comes from