atomic_add_return_acquire(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… atomic_add_return_acquire(9) β€” the Kernel API Manual, but make it cute

okay so bestie, this one comes to you straight out of the Kernel API Manual, and it's genuinely one of the cleanest little atomics in the whole family. atomic_add_return_acquire(9) β€” say it with me β€” it adds stuff, it hands the new number back to you, and it does the whole thing with acquire ordering. iconic behavior honestly. πŸŽ€


✨ NAME ✨

atomic_add_return_acquire β€” atomic add with acquire ordering πŸ¦‹


🌸 SYNOPSIS 🌸

int atomic_add_return_acquire (int i , atomic_t *v );

πŸŽ€ ARGUMENTS πŸŽ€

  • i β€” the int value you're adding. your contribution. your little gift to the counter πŸ’–
  • v β€” pointer to the atomic_t. this is the girl getting updated, she's the main character here πŸ‘‘

πŸ’… DESCRIPTION πŸ’…

Atomically updates v to (v + i) with acquire ordering. that's it, that's the whole vibe β€” no cap, no tearing, no half-done weirdness. it just happens. all at once. πŸ”₯

🚨 real talk bestie: this is unsafe to use in noinstr code. if you're in noinstr land, use raw_atomic_add_return_acquire there instead. don't be brave, be correct. πŸ’€

⭐ RETURN ⭐

The updated value of v. so like, after the add β€” the new number, not the old one. the glow-up version. 🫢


🌈 SEE ALSO 🌈

first up, the home base β€” this whole family lives in the kernel file ./include/linux/atomic/atomic-instrumented.h. go say hi to the source, she's lovely ✨

🧚 the atomic_t girlies

πŸ’œ the atomic64_t girlies (the 64-bit girlbosses)

πŸ“ the atomic_long girlies


okay that's the whole roster, iykyk πŸ’– go forth and add atomically, bestie. mwah. 🫢

signed, sealed, delivered from the source file ./include/linux/atomic, dated October 2026 β€” this has been your girl atomic_add_return_acquire(9) from the Kernel API Manual, and she ate. periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from