ATOMIC_SWAP_UINT(9) | Kernel Developer's Manual | ATOMIC_SWAP_UINT(9) |

`atomic_swap_uint`

,
`atomic_swap_ulong`

,
`atomic_swap_ptr`

—
atomic swap operations

`#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`);

The value referenced by the pointer `p` is
replaced by the value `new`.

`atomic_swap_uint`

(),
`atomic_swap_ulong`

(), and
`atomic_swap_ptr`

() can all be called during autoconf,
from process context, or from interrupt context.
July 18, 2014 | OpenBSD-current |