ATOMIC_SWAP_UINT(9)
π 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 π₯
atomic_cas_uint(9)β go read this next, bestie, iykyk π§
π 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
- Copyright (c) 2014 David Gwynne <dlg@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms