wait_on_bit_lock(9)
π wait_on_bit_lock(9) β like, the kernel API manual, bestie β¨
okay so welcome to the glow-up of wait_on_bit_lock, a kernel API manual page, and honestly? she's iconic. buckle up π
πΈ NAME πΈ
wait_on_bit_lock β wait for a bit to be cleared, then set it. that's the whole vibe. wait, then snatch. π
β¨ SYNOPSIS β¨
int wait_on_bit_lock (unsigned long *word , int bit , unsigned mode );
π«Ά ARGUMENTS π«Ά
wordβ the address containing the bit being waited on. it's giving "where the drama lives" πbitβ the bit of the word being waited on and set. yes, both. she's multitalented πββοΈmodeβ the task state to sleep in π΄ the actual napping configuration, no cap
π¦ DESCRIPTION π¦
okay so picture this: you're waiting for the given bit in an unsigned long or a bitmap (see DECLARE_BITMAP) to be cleared. cleared. gone. bye. π
and like β important β the clearing of the bit must be signalled with wake_up_bit, often as clear_and_wake_up_bit. that's the bat signal, bestie. no signal, no party π¨
as soon as it's clear, this function atomically sets it and returns. atomic. like she does it all in one breath, no gaps, no interleaving. main character energy π₯
this is similar to wait_on_bit, but sets the bit before returning. so like, her cousin, but she does more π
the returned value will be zero if the bit was successfully set β and in that case the call has the same memory sequencing semantics as test_and_clear_bit β or it'll be -EINTR if the process received a signal and the mode permitted wake up on that signal π
lowkey important:-EINTRmeans a signal barged in mid-nap. that's not a bug, that's themodeyou asked for π
π§ SEE ALSO π§
kernel file ./include/linux/wait_bit.h, plus the whole friend group, fr fr:
wait_on_bit(9)wait_on_bit_io(9)wait_on_bit_timeout(9)wait_on_bit_action(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)atomic_dec_and_wake_up(9)store_release_wake_up(9)
and that's the page, bestie π bye bestie, go set some bits π β this one's from ./include/linux, dated October 2026, and it's wait_on_bit_lock(9) all the way down πβπ
π¦ 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