unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (OpenBSD-5.7)
Page:
Section:
Apropos / Subsearch:
optional field

ATOMIC_CAS_UINT(9)       BSD Kernel Developer's Manual      ATOMIC_CAS_UINT(9)

NAME
     atomic_cas_uint, atomic_cas_ulong, atomic_cas_ptr -- atomic compare-and-
     swap operations

SYNOPSIS
     #include <&lt;sys/atomic.h>&gt;

     unsigned int
     atomic_cas_uint(volatile unsigned int *p, unsigned int expected,
         unsigned int new);

     unsigned long
     atomic_cas_ulong(volatile unsigned long *p, unsigned long expected,
         unsigned long new);

     void *
     atomic_cas_ptr(volatile void *p, void *expected, void *new);

DESCRIPTION
     The atomic_cas set of functions provide an interface for atomically per-
     forming compare-and-swap operations with respect to interrupts and multi-
     ple processors in the system.

     The value referenced by the pointer p is compared against expected.  If
     these values are equal then new replaces the value stored at p.

CONTEXT
     atomic_cas_uint(), atomic_cas_ulong(), and atomic_cas_ptr() can all be
     called during autoconf, from process context, or from interrupt context.

RETURN VALUES
     These functions return the value at p as it was before the attempt to
     swap it.

SEE ALSO
     atomic_swap_uint(9)

HISTORY
     The atomic_cas functions first appeared in NetBSD 5.0 and OpenBSD 5.5.

BSD                              July 18, 2014                             BSD