atomic_cmpxchg_release(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ NAME ✨

atomic_cmpxchg_release β€” atomic compare and exchange, but make it release ordering πŸ’… (this is from the Kernel API Manual, bestie, and it's lowkey iconic)


πŸ¦‹ SYNOPSIS πŸ¦‹

int atomic_cmpxchg_release (atomic_t *v , int old , int new );

πŸŽ€ ARGUMENTS πŸŽ€

  • v β€” pointer to atomic_t (the vibe you're checking, basically)
  • old β€” int value to compare with πŸ‘€
  • new β€” int value to assign if the compare says slay

🌸 DESCRIPTION 🌸

So here's the tea β˜•: if (v == old), this atomically updates v to new with release ordering. Otherwise, v is not modified and relaxed ordering is provided. No cap.

⚠️ It is unsafe to use in noinstr code β€” use raw_atomic_cmpxchg_release there instead. Please don't make it weird, bestie 😭

πŸ’– RETURN πŸ’–

The original value of v. That's the whole reveal πŸ‘‘


🌈 SEE ALSO 🌈

Kernel file ./include/linux/atomic/atomic-instrumented.h β€” and like, the entire atomic extended universe lives here, fr fr:


okay that's the whole page, bestie 🫢 this little gem came from the source ./include/linux/atomic, version October 2026, and the page itself is atomic_cmpxchg_release(9) β€” go forth and atomically slay πŸ’…βœ¨

πŸ“¦ where this page comes from