wait_on_bit(9)
π wait_on_bit(9) π
okay so bestie, welcome to the Kernel API Manual page for wait_on_bit(9) β it's giving βsleep until that bit is clearedβ energy and honestly? iconic. π¦
β¨ NAME β¨
wait_on_bit β wait for a bit to be cleared π
β¨ SYNOPSIS β¨
the signature is literally right here, no cap:
int wait_on_bit (unsigned long *word , int bit , unsigned mode );
β¨ ARGUMENTS β¨
wordβ the address containing the bit being waited on πbitβ the bit at that address being waited on β¨modeβ the task state to sleep in π΄
β¨ DESCRIPTION β¨
okay so this function waits for the given bit in an unsigned long or bitmap (see DECLARE_BITMAP) to be cleared. yes, that bit. the one you're obsessed with. π«Ά
the clearing of the bit must be signalled with wake_up_bit, often as clear_and_wake_up_bit. like, do not forget this part, bestie β it's the whole vibe. π
the process will wait on a waitqueue selected by hash from a shared pool. and here's the cute part: it will only be woken on a wake_up for the target bit, even if other processes on the same queue are waiting for other bits. main character energy only. π
the returned value will be zero if the bit was cleared β in which case the call has ACQUIRE semantics β or -EINTR if the process received a signal and the mode permitted wake up on that signal. periodt. π
β¨ SEE ALSO β¨
the kernel file is ./include/linux/wait_bit.h, and the bestie list is:
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)atomic_dec_and_wake_up(9)store_release_wake_up(9)
signed, sealed, slayed from ./include/linux β October 2026 β for wait_on_bit(9) πβ¨
π¦ 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