ATOMIC_SWAP_UINT(9)

πŸ“¦ in nixpkgs unstable

πŸ‘‘ ATOMIC_SWAP_UINT(9) πŸ‘‘

okay bestie, welcome to the Kernel Developer's Manual entry for the atomic swap girlies ✨ this is the whole page, every detail intact, no cap πŸ’…


πŸ’– NAME πŸ’–

atomic_swap_uint, atomic_swap_ulong, atomic_swap_ptr β€” atomic swap operations 🫢


✨ SYNOPSIS ✨

#include <sys/atomic.h>

unsigned int
atomic_swap_uint(volatile unsigned int *p, unsigned int new);

unsigned long
atomic_swap_ulong(volatile unsigned long *p, unsigned long new);

void *
atomic_swap_ptr(volatile void *p, void *new);

πŸ¦‹ DESCRIPTION πŸ¦‹

The atomic_swap set of functions is literally giving you an interface for atomically performing swap operations with respect to interrupts and multiple processors in the system. iconic behavior, honestly πŸ‘‘

The value referenced by the pointer p is replaced by the value new. that's the whole swap, periodt πŸ’«


🌸 CONTEXT 🌸

atomic_swap_uint(), atomic_swap_ulong(), and atomic_swap_ptr() can all be called during autoconf, from process context, or from interrupt context. versatile queens πŸ’…βœ¨


πŸŽ€ RETURN VALUES πŸŽ€

These functions return the value at p as it was before the swap operation. so you get the old vibe back, very main character energy πŸ’–


πŸ”₯ SEE ALSO πŸ”₯


🌈 HISTORY 🌈

The atomic_swap functions first appeared in NetBSD 5.0 and OpenBSD 5.5. vintage but still slaying ⭐


xoxo, your fav kernel bestie πŸ’œ this page is from Debian, dated July 18, 2014 β€” drink water and check your pointers, fr fr πŸ“πŸŽ€

πŸ“¦ where this page comes from
  • nixpkgs unstable: cvs-export
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms