local_dec_and_test(9)
π local_dec_and_test(9) π
okay so welcome to the Kernel API Manual, bestie β today's main character is local_dec_and_test, and honestly? she's a little icon. let's get into it β¨
πΈ NAME πΈ
local_dec_and_test β decrement and test. that's it, that's the whole vibe. she takes one away and then does a lil vibe check on the result π
β¨ SYNOPSIS β¨
bool local_dec_and_test (local_t *l );
no cap, that's the entire signature. short and slay π
π¦ ARGUMENTS π¦
lβ a pointer to typelocal_t. yeah she wants the address, not the thing itself. hand her the pointer and she's good π«Ά
π₯ DESCRIPTION π₯
so here's the tea: local_dec_and_test atomically decrements l by 1, and then it's like, ok bestie, let's check β it returns true if the result is 0, and false for all other cases. literally all of them. no exceptions, no in-between, no "it depends" energy π
key word there is atomically β the whole decrement-and-check happens as one indivisible moment, so nobody's gonna sneak in mid-decrement and mess with your math. icon behavior fr fr π
lowkey a reminder so you don't get caught out:truemeans the thing hit exactly0. anything else on the number line gives youfalse. that's the entire contract, don't go reading extra lore into it π
β SEE ALSO β
- kernel file
./arch/x86/include/asm/local.h local_sub_and_test(9)local_inc_and_test(9)local_add_negative(9)local_add_return(9)local_add_unless(9)
the whole local_* friend group really said "we're a package deal" π go say hi to the rest of them, they're all linked from ./arch/x86/include/asm/local.h and they ate π
and that's the page! π§ this little drop came from ./arch/x86/include/asm, dated October 2026 β so yeah, she's fresh, she's documented, and she's absolutely serving kernel-internals realness. mwah, go decrement something responsibly ππΈ
local_dec_and_test(9) π β bye bestie!! π«Ά
π¦ 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