test_and_clear_wake_up_bit(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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:

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