wait_event_...usive_locked(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’€ wait_event_...usive_locked(9) β€” the glow-up ✨

okay so real talk, this is a page from the Kernel API Manual (yes, the actual kernel manual, we're fancy now πŸ’…) and the star of the show is wait_event_interruptible_exclusive_locked. long name? yes. iconic behavior? also yes. let's get into it bestie 🫢


πŸŽ€ NAME

wait_event_interruptible_exclusive_locked β€” sleep exclusively until a condition gets true πŸ¦‹

like, it naps, but it naps with main character energy β€” nobody else on the list gets to wake up with it. periodt.


✨ SYNOPSIS

wait_event_interruptible_exclusive_locked (wq , condition );

that's it. two things in, vibes out πŸ’– (also yes, that spacing is exactly how it's written, don't come for me)


🌸 ARGUMENTS

  • wq β€” the waitqueue to wait on πŸ›οΈ like, this is the bed your process is gonna crash in while it waits.
  • condition β€” a C expression for the event to wait for ⭐ this is the "am I awake yet??" check.

πŸ’œ DESCRIPTION

okay so here's the whole situation, no cap:

The process is put to sleep (TASK_INTERRUPTIBLE) until the condition evaluates to true or a signal is received. and the condition gets checked every single time the waitqueue wq is woken up πŸ”₯ like, every poke = one vibe check.

⚠️ big one: it must be called with wq.lock being held. like, that's not optional, that's the whole contract bestie.

That spinlock gets 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 comes back exactly how it left β€” icon behavior, honestly.

The lock is locked/unlocked using spin_lock/spin_unlock functions, and those must match the way they are locked/unlocked outside of this macro. 🧚 matchy matchy or it does not slay.

The process is put on the wait queue with a WQ_FLAG_EXCLUSIVE flag set β€” and the way that works is, when other processes are waiting, if this process is awakened, further processes are not considered. πŸ™ˆ like sorry girlies, this one's mine.

wake_up_locked has to be called after changing any variable that could change the result of the wait condition. 🫑 that's the assignment, don't skip it.

Return values (the receipts πŸ’€):

  • -ERESTARTSYS if it was interrupted by a signal 😭
  • 0 if the condition evaluated to true βœ…

🌈 SEE ALSO

the whole friend group 🫢 also from the kernel file ./include/linux/wait.h:

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_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)


mwah πŸ’‹ that's the page!! this one lives at ./include/linux and the version is dated October 2026 β€” so yeah, future girlies are still out here waiting on waitqueues. go forth and sleep exclusively, bestie πŸ‘‘βœ¨

πŸ“¦ where this page comes from