arch___test_and_clear_bit(9)
π arch___test_and_clear_bit(9) β Kernel API Manual β¨
okay so bestie, buckle up, we're reading a kernel API manual page together and honestly? it's lowkey iconic. this is arch___test_and_clear_bit, straight out of the kernel API manual, and it's giving "tiny function, big responsibilities." π
πΈ NAME πΈ
arch___test_and_clear_bit β clear a bit and return its old value π«Ά
β SYNOPSIS β
bool arch___test_and_clear_bit (unsigned long nr , volatile unsigned
long *addr );
π¦ ARGUMENTS π¦
nrβ the bit you want to clear, bestie. that's the one. πaddrβ the address to count from. yes, "count from," that's literally what it says, don't come for me. π
π₯ DESCRIPTION π₯
okay so here's the tea, and it's important tea: this operation is non-atomic and can be reordered. not me warning you about race conditions twice in one sentence, but here we are. π
if two examples of this operation race, one can appear to succeed but actually fail. like??? imagine winning and then finding out you didn't win. the audacity. π
so no cap: you must protect multiple accesses with a lock. periodt. if you skip the lock, that's on you and the vibe check will not be kind. π
π SEE ALSO π
- Kernel file
./arch/sh/include/asm/bitops-op32.hβ the literal source of truth, iykyk π arch___change_bit(9)β the cousin that changes bits β¨arch___test_and_set_bit(9)β the cousin that sets bits πΈ
and that's the whole page, bestie! this one came from ./arch/sh/include/asm and it's dated October 2026, so likeβ¦ remember it fondly. mwah π π§ββοΈ π
π¦ 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