test_and_set_bit_lock(9)
π test_and_set_bit_lock(9) π
okay so welcome to the Kernel API Manual corner, bestie β this page is literally about test_and_set_bit_lock, and it's giving tiny atomic bit-lock icon energy. β¨
πΈ NAME πΈ
test_and_set_bit_lock β sets a bit, returns its old value, and it's for lock. That's the whole vibe: set the bit, hand back what was there before, lock-style. Periodt. π
π¦ SYNOPSIS π¦
bool test_and_set_bit_lock (long nr , volatile unsigned long *addr );
Lowkey just keep that signature exactly as-is, because every character matters here. π«Ά
π ARGUMENTS π
nrβ bit to set. You're picking the bit, bestie. πaddrβ address to count from. Yes, that's literally the description; no cap. π
π₯ DESCRIPTION π₯
This operation is atomic and provides acquire barrier semantics if the returned value is 0. That "if" is doing main-character work, so don't sleep on it. π
It can be used to implement bit locks. Iconic. π
π SEE ALSO π
- Kernel file
./include/asm-generic/bitops/instrumented-lock.hβ the source-file bestie for this one. π§ clear_bit_unlock(9)__clear_bit_unlock(9)xor_unlock_is_negative_byte(9)
mwah π this page comes from ./include/asm-generic/bitops, dated October 2026, and it's part of the Kernel API Manual. Go set that bit, bestie β atomic and cute. πβ¨
π¦ 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