atomic_dec_and_wake_up(9)
β¨ atomic_dec_and_wake_up(9) β¨
okay so bestie, welcome to the atomic_dec_and_wake_up page from the Kernel API Manual β this one's a little kernel function that does a thing and then, like, politely tells everyone waiting that they can go now π
π NAME π
atomic_dec_and_wake_up β decrement an atomic_t, and if it hits zero, wake up the waiters π«Ά
πΈ SYNOPSIS πΈ
bool atomic_dec_and_wake_up (atomic_t *var );
π¦ ARGUMENTS π¦
varβ the variable to dec and test β¨ (yes, both, it's a whole multitasking icon)
π DESCRIPTION π
So here's the vibe: it decrements the atomic variable, and if that decrement brings it all the way down to zero, it sends a wake_up to any processes that are waiting on that variable π like "bestie the count is done, you may proceed."
Highkey important: this function has the same complete ordering semantics as atomic_dec_and_test. Not "kind of similar", not "close enough" β the same complete ordering semantics. No cap. π₯
Returns true if the variable reaches zero and the wake up was sent π
π SEE ALSO π
Kernel file ./include/linux/wait_bit.h β and honestly the whole wait_bit extended universe, all of it, every single one, no skipping π:
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)wait_var_event_mutex(9)wake_up_var_protected(9)wake_up_var_locked(9)clear_and_wake_up_bit(9)test_and_clear_wake_up_bit(9)store_release_wake_up(9)
fr fr go read the wait_bit.h crew next, they're all iconic β
mwah, that's the page π this lil number lives in ./include/linux and the version stamp on it is October 2026 β dated, slayed, and permanently serving ππ
π¦ 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