wait_event_...tible_locked(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’€ wait_event_interruptible_locked β€” the man page, but make it make sense

okay so real talk, this is from the Kernel API Manual, section 9, and the page is literally called wait_event_...tible_locked(9) (yes the ellipsis is doing a lot of work there, that's just how they abbreviate it, don't come for me πŸ’…).


✨ NAME ✨

wait_event_interruptible_locked β€” sleep until a condition gets true πŸŽ€

Like, actually sleep. Not doomscroll-and-pretend-to-sleep. The kernel kind.


πŸ¦‹ SYNOPSIS πŸ¦‹

wait_event_interruptible_locked (wq , condition );

That's it. Two things in, vibes out.


🌸 ARGUMENTS 🌸

  • wq β€” the waitqueue to wait on. this is the queue bestie, the place everyone's hanging out until something happens 🫢
  • condition β€” a C expression for the event to wait for. literally just "keep sleeping until this is true", no cap

πŸ”₯ DESCRIPTION πŸ”₯

The process is put to sleep (TASK_INTERRUPTIBLE) until the condition evaluates to true or a signal is received. Either one gets you out of bed, so to speak. The condition is checked each time the waitqueue wq is woken up πŸ‘‘

it's giving "nap with one eye open" energy and honestly? iconic.

It must be called with wq.lock being held. Not optional, not a suggestion, this is the whole contract bestie. That spinlock is unlocked while sleeping, but the condition testing is done while the lock is held, and when this macro exits, the lock is held again. So it goes: held β†’ unlocked-while-you-snooze β†’ held again by the time you're back. Zero surprises (if you followed the rules) πŸ’–

The lock is locked/unlocked using spin_lock/spin_unlock functions, which must match the way they are locked/unlocked outside of this macro. fr fr, keep it consistent, don't mix and match, that's how you end up in a very bad mood 😭

wake_up_locked has to be called after changing any variable that could change the result of the wait condition. Like, change the thing β†’ wake everybody β†’ then everyone re-checks. That's the whole loop. That's the bit. ⭐

The function will return -ERESTARTSYS if it was interrupted by a signal, and 0 if condition evaluated to true 🌈


🧚 SEE ALSO 🧚

Kernel file ./include/linux/wait.h, plus this whole friend group of related calls β€” yes I'm listing every single one, we don't do "etc." here πŸ“


okay that's the whole page, go forth and hold your locks correctly πŸ’œ

sourced from ./include/linux, dated October 2026, filed under wait_event_...tible_locked(9) β€” mwah, that's the sign-off, literally obsessed with you for reading this far πŸŽ€βœ¨

πŸ“¦ where this page comes from