wait_var_event_mutex(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

okay bestie, welcome to the Kernel API Manual page for wait_var_event_mutex(9) β€” it's literally the β€œwait for a variable to be updated under a mutex” icon. πŸ’…

wait_var_event_mutex β€” wait for a variable to be updated under a mutex. slay.


🌸 SYNOPSIS 🌸

wait_var_event_mutex (var , condition , lock );

πŸ’… ARGUMENTS πŸ’…

  • var β€” the address of the variable being waited on, bestie. literally the address.
  • condition β€” condition to wait for. yes ma'am.
  • lock β€” the mutex which protects updates to the variable. it's giving bodyguard energy.

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so picture this: you're waiting for a condition which can only be reliably tested while holding a mutex. the variables assessed in the condition will normal be updated under the same mutex, and the wake up should be signalled with wake_up_var_locked under the same mutex. 🫢

this is similar to wait_var_event, but assumes a mutex is held while calling this function and while updating the variable. lowkey a whole vibe.

this must be called while the given mutex is held and the mutex will be dropped when schedule is called to wait for a wake up, and will be reclaimed before testing the condition again. no cap, that's the whole flow. πŸ’–


πŸŽ€ SEE ALSO πŸŽ€

the whole friend group lives in the Kernel file ./include/linux/wait_bit.h: wait_on_bit(9), wait_on_bit_io(9), wait_on_bit_timeout(9), wait_on_bit_action(9), wait_on_bit_lock(9), wait_on_bit_lock_io(9), wait_on_bit_lock_action(9), wait_var_event(9), wait_var_event_io(9), wait_var_event_killable(9), wait_var_event_timeout(9), wait_var_event_interruptible(9), wait_var_event_any_lock(9), wait_var_event_spinlock(9), wake_up_var_protected(9), wake_up_var_locked(9), clear_and_wake_up_bit(9), test_and_clear_wake_up_bit(9), atomic_dec_and_wake_up(9), and store_release_wake_up(9). ✨


bye bestie 🫢 β€” source/version: ./include/linux; date: October 2026; and yes, it's the wait_var_event_mutex(9) page. mwah πŸ’‹

πŸ“¦ where this page comes from