raw_atomic_...turn_acquire(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ NAME ✨</p>

raw_atomic_dec_return_acquire β€” atomic decrement, but make it acquire-ordered πŸ’…

(also hi bestie, this one's from the Kernel API Manual, section 9 β€” kernel dev coded, group chat approved 🫢)


🌸 SYNOPSIS 🌸

int raw_atomic_dec_return_acquire (atomic_t *v );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • v β€” pointer to atomic_t. that's it. that's the whole argument. a little pointer bestie pointing at your atomic πŸ’–

⭐ DESCRIPTION ⭐

okay so picture this: you've got a value, and you need it to go down by exactly one, atomically β€” no racing, no "oops two threads got in there", none of that 😭

raw_atomic_dec_return_acquire atomically updates v to (v - 1) with acquire ordering. one clean little decrement, fully locked in πŸ”₯

and here's the tea β˜• β€” it's safe to use in noinstr code. but like, if you're not in noinstr code? prefer atomic_dec_return_acquire elsewhere. fr fr, that's the move.

πŸ‘‘ RETURN πŸ‘‘

the updated value of v β€” i.e. the value after the decrement, not before. you get the new number, the glow-up number, the post-decrement number ✨


πŸŽ€ SEE ALSO πŸŽ€

first up, the source file, right here in the kernel tree:

  • Kernel file ./include/linux/atomic/atomic-arch-fallback.h

and now the whole entire family, because apparently atomic ops are a huge family and we love that for them πŸ’€βœ¨

the 32-bit raw_atomic_ girlies:

and the 64-bit raw_atomic64_ icons (yes there are so many, they ate):

like I said. huge family. every single one of them got an invite to the function list πŸ’–


okay that's the whole page bestie, you're officially an atomic decrement expert 🧚✨ this one lives in ./include/linux/atomic, dated October 2026 β€” go forth and decrement responsibly, mwah πŸ’…πŸŽ€

πŸ“¦ where this page comes from