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

`atomic_add_int`

,
`atomic_add_int_nv`

,
`atomic_add_long`

,
`atomic_add_long_nv`

—
atomic addition operations

`#include <sys/atomic.h>`

`void`

`atomic_add_int`

(`volatile
unsigned int *p`, `unsigned
int v`);

`unsigned int`

`atomic_add_int_nv`

(`volatile
unsigned int *p`, `unsigned
int v`);

`void`

`atomic_add_long`

(`volatile
unsigned long *p`,
`unsigned long v`);

`unsigned long`

`atomic_add_long_nv`

(`volatile
unsigned long *p`,
`unsigned long v`);

The value referenced by the pointer `p` is
incremented by the value `v`.

`atomic_add_int`

(),
`atomic_add_int_nv`

(),
`atomic_add_long`

(), and
`atomic_add_long_nv`

() can all be called during
autoconf, from process context, or from interrupt context.
`atomic_add_int`

and
`atomic_add_long`

perform the addition without returning
any knowledge of the value at `atomic_add_int_nv`

and
`atomic_add_long_nv`

return the value at
`p` after the addition was performed.

February 13, 2014 | OpenBSD-current |