wait_event_lock_irq_cmd(9)
π wait_event_lock_irq_cmd(9) π
okay bestie, welcome to the Kernel API Manual β this one is giving "sleepy kernel function with main character energy" and honestly? iconic. β¨
β¨ NAME β¨
wait_event_lock_irq_cmd β sleep until a condition gets true. The condition is checked under the lock, and this is expected to be called with the lock taken. π
πΈ SYNOPSIS πΈ
wait_event_lock_irq_cmd (wq_head , condition , lock , cmd );
π ARGUMENTS π
wq_headβ the waitqueue to wait on. literally the queue where your sleepy little process is gonna chill. π΄conditionβ a C expression for the event to wait for. this is the thing that has to become true before you wake up, no cap. β¨lockβ a lockedspinlock_t, which will be released beforecmdandscheduleand reacquired afterwards. yes bestie, it locks, it unlocks, it locks again β the full glow-up cycle. πcmdβ a command which is invoked outside the critical section before sleep. tiny side quest before naptime. π«Ά
π¦ DESCRIPTION π¦
The process is put to sleep (TASK_UNINTERRUPTIBLE) until the condition evaluates to true. The condition is checked each time the waitqueue wq_head is woken up. so like, every wake-up is a vibe check for your condition. π
wake_up has to be called after changing any variable that could change the result of the wait condition. don't forget this part, fr fr β otherwise your process is just gonna be asleep forever and that's not the slay you think it is. π
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 order is: hold the lock β drop it β run cmd β sleep β wake up β grab the lock again. periodt. π
π SEE ALSO π
Kernel file ./include/linux/wait.h β and the whole waitqueue friend group, because they all ate:
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(9)wait_event_interruptible_lock_irq_cmd(9)wait_event_interruptible_lock_irq(9)wait_event_interruptible_lock_irq_timeout(9)
and that's the whole page, bestie β sourced from ./include/linux, dated October 2026, and yes the function is still wait_event_lock_irq_cmd(9) because we don't do name changes around here. πβ¨π
π¦ 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