test_and_clear_wake_up_bit(9)
π test_and_clear_wake_up_bit(9) π
okay so bestie, welcome to the Kernel API Manual β¨ β yes, that's the manual name, and yes, this is genuinely a kernel function page, and yes, we're gonna get through it together π«Ά
πΈ NAME πΈ
test_and_clear_wake_up_bit β clears a bit only if it was set, and then wakes up literally anyone who was waiting on that bit π
periodt
β¨ SYNOPSIS β¨
bool test_and_clear_wake_up_bit (int bit , unsigned long *word );
look at her. two arguments, one bool return. clean. iconic. no notes π₯
π ARGUMENTS π
bitβ the actual bit of the word that everyone's been waiting on. the main character bit πwordβ the address of the memory that contains that bit. like, where the bit lives π
π¦ DESCRIPTION π¦
so here's the vibe π« if the bit is set and it can be atomically cleared, then all the tasks sitting around in wait_on_bit or similar β they get woken up. every single one. no one left on read π
and ngl, this call has the same complete ordering semantics as test_and_clear_bit β that's not a cute little detail, that's the whole point, so don't sleep on it. any changes to memory you made before this call are guaranteed to be visible after the corresponding wait_on_bit completes π§ that's a real guarantee, fr fr, not just a suggestion.
returns true if the bit was successfully set and the wake up was sent π like, mission accomplished.
β οΈ ykw β this is a memory-ordering, atomicity-sensitive kernel primitive. treat it with the respect it deserves π
π SEE ALSO π
kernel file ./include/linux/wait_bit.h β¨ and honestly, the whole friend group:
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)atomic_dec_and_wake_up(9)store_release_wake_up(9)
like, the whole squad is here π«Ά go read them too, they all ate π₯
and that's the page!! π this whole thing comes from ./include/linux and it's dated October 2026 β so mark your calendar, bestie π
π mwah, go write some correct kernel code π
β¨π
π¦ 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