wait_event_...lock_irq_cmd(9)
π€ wait_event_interruptible_lock_irq_cmd(9) β the "sleep till it's true, but hold the lock and run a lil command" macro π€
okay so bestie, welcome to the Kernel API Manual, section 9 β this is the page for wait_event_interruptible_lock_irq_cmd, and yes the header up top is all wait_event_...lock_irq_cmd(9) because that name is long and the manpage machinery got shy. same macro tho. π
β¨ NAME β¨
wait_event_interruptible_lock_irq_cmd β sleep until a condition gets true. the condition is checked under the lock. this is expected to be called with the lock taken. π
β¨ SYNOPSIS β¨
wait_event_interruptible_lock_irq_cmd (wq_head , condition , lock , cmd );
like, four things go in. that's it. that's the whole vibe. π¦
β¨ ARGUMENTS β¨
wq_headβ the waitqueue to wait on. this is the lil hangout spot where your process chills until someone wakes it up. πΈconditionβ a C expression for the event to wait for. it's literally just "am I done yet" written as code. π₯lockβ a lockedspinlock_t, which will be released beforecmdandscheduleand reacquired afterwards. yes, it lets go of the lock mid-macro. that's the whole point, don't panic. πcmdβ a command which is invoked outside the critical section before sleep. it runs before you snooze, and it runs unlocked. π§
β¨ DESCRIPTION β¨
so the process gets put to sleep (TASK_INTERRUPTIBLE) until the condition evaluates to true or a signal is received. the condition is checked each time the waitqueue wq_head is woken up. π
wake_up has to be called after changing any variable that could change the result of the wait condition. no cap β if you flip the variable and forget the wake_up, your poor process is gonna be napping forever and that's on you, bestie. π
this is supposed to be called while holding the lock. the lock is dropped before invoking the cmd and going to sleep and is reacquired afterwards. so the sequence is giving: hold lock β drop it β run cmd β sleep β wake up β reacquire lock. iconic, honestly. β¨
the macro will return-ERESTARTSYSif it was interrupted by a signal and0if condition evaluated to true. those are the only two moods. π
β¨ SEE ALSO β¨
Kernel file ./include/linux/wait.h β and the whole waitqueue friend group, fr fr:
waitqueue_active(9)wq_has_single_sleeper(9)wq_has_sleeper(9)wake_up_pollfree(9)wait_event(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(9)wait_event_interruptible_lock_irq_timeout(9)
okay that's the whole page, you ate that π«Ά this one lives in ./include/linux, dated October 2026, and the title up in the corner is wait_event_...lock_irq_cmd(9) β go forth and wait on your waitqueues responsibly, mwah ππ·
π¦ 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