wait_event(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’€ wait_event(9) β€” the sleep-until-it's-true icon

okay so real talk, this is from the Kernel API Manual, section 9, and it's literally just called wait_event. bestie. the name ate. let's go 🫢


πŸŽ€ NAME πŸŽ€

wait_event β€” sleep until a condition gets true

like, you just nap. politely. until the thing happens. that's the whole vibe πŸ’…


✨ SYNOPSIS ✨

wait_event (wq_head , condition );

that's it. that's the whole function. two little guys in the parens and you're done 🌸


πŸ¦‹ ARGUMENTS πŸ¦‹

  • wq_head β€” the waitqueue to wait on. this is the queue your process is gonna curl up on, like a lil bed πŸ›οΈ
  • condition β€” a C expression for the event to wait for. literally just "what am i waiting for" as code. you write the expression, the kernel vibes on it until it's true πŸ”₯

πŸ‘‘ DESCRIPTION πŸ‘‘

so here's the tea β˜•: the process gets put to sleep β€” and not just any sleep, specifically TASK_UNINTERRUPTIBLE β€” until the condition evaluates to true. every single time the waitqueue wq_head gets woken up, the condition gets checked again. that's the loop. check, sleep, wake, check, sleep, wake. main character energy honestly πŸ’œ

⚠️ important, no cap: wake_up has to be called after changing any variable that could change the result of the wait condition. if you flip the variable and don't call wake_up, your poor lil process is gonna be snoozing forever and nobody's coming to get it 😭 like it's giving "left on read" but make it a kernel deadlock. so fr fr, always wake_up.

🌈 SEE ALSO 🌈

all the siblings, cousins and extended family of this function live in the Kernel file ./include/linux/wait.h. check 'em out πŸ‘‡

that's a whole friend group right there, they're all so valid 🧚


and that's the whole page, bestie πŸ’– this one came out of ./include/linux in October 2026, filed under wait_event(9). go take a nap, you earned it πŸ“βœ¨

πŸ“¦ where this page comes from