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

`atomic_sub_int`

,
`atomic_sub_int_nv`

,
`atomic_sub_long`

,
`atomic_sub_long_nv`

—
atomic subtraction operations

`#include <sys/atomic.h>`

`void`

`atomic_sub_int`

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

`unsigned int`

`atomic_sub_int_nv`

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

`void`

`atomic_sub_long`

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

`unsigned long`

`atomic_sub_long_nv`

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

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

`atomic_sub_int`

(),
`atomic_sub_int_nv`

(),
`atomic_sub_long`

(), and
`atomic_sub_long_nv`

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

and
`atomic_sub_long`

perform the subtraction without
returning any knowledge of the value at `atomic_sub_int_nv`

and
`atomic_sub_long_nv`

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

July 23, 2014 | OpenBSD-current |