wait_event(9)
π€ 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_uphas to be called after changing any variable that could change the result of the wait condition. if you flip the variable and don't callwake_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, alwayswake_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 π
waitqueue_active(9)wq_has_single_sleeper(9)wq_has_sleeper(9)wake_up_pollfree(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_timeout(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)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms