wait_event_...e_locked_irq(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

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

okay so bestie, welcome to the <pink>Kernel API Manual</pink> ✨ this one is about wait_event_interruptible_locked_irq, and yes the name is a whole paragraph, we're gonna get through it together 🫢


🌸 NAME 🌸

wait_event_interruptible_locked_irq β€” sleep until a condition gets true πŸ’€βœ¨


πŸŽ€ SYNOPSIS πŸŽ€

wait_event_interruptible_locked_irq (wq , condition );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • wq β€” the waitqueue to wait on. it's the line you're standing in, metaphorically 🌈
  • condition β€” a C expression for the event to wait for. like, the thing you're literally waiting around for πŸ‘‘

πŸ’… DESCRIPTION πŸ’…

so the process gets put to sleep (TASK_INTERRUPTIBLE) until condition evaluates to true, or until a signal shows up and ruins the nap 😭 and the condition gets checked every single time the waitqueue wq is woken up. every time. it's committed like that πŸ’–

fr fr, it must be called with wq.lock being held. no exceptions, no "but Iβ€”", none of that πŸ™ˆ

so here's the tea on the spinlock β˜• this 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. so it leaves the lock exactly as it found it β€” main character energy that respects the dress code πŸ‘‘

the lock is locked/unlocked using spin_lock_irq/spin_unlock_irq functions, and those must match the way they are locked/unlocked outside of this macro. consistency is the vibe check, ngl βœ…

wake_up_locked has to be called after changing any variable that could change the result of the wait condition. like, if you moved the thing they're waiting for, you gotta tell them πŸ””

and the return values, bestie:

  • 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 β€” and honestly the whole waitqueue friend group, they all ate:


this page lives in ./include/linux and it's dated October 2026 🌸 like, go read the header files bestie, they're right there πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from