#include <linux/types.h>
#include <asm/cmpxchg.h>
Go to the source code of this file.
|
#define | ATOMIC_INIT(i) { (i) } |
|
#define | atomic_set(v, i) ((v)->counter = (i)) |
|
#define | atomic_read(v) ((v)->counter) |
|
#define | atomic_xchg(v, new) (xchg(&((v)->counter), (new))) |
|
#define | atomic_add(i, v) atomic_add_return(i, (v)) |
|
#define | atomic_sub(i, v) atomic_sub_return(i, (v)) |
|
#define | atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) |
|
#define | atomic_inc(v) atomic_add(1, (v)) |
|
#define | atomic_dec(v) atomic_sub(1, (v)) |
|
#define | atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0) |
|
#define | atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) |
|
#define | atomic_sub_and_test(i, v) (atomic_sub_return(i, (v)) == 0) |
|
#define | atomic_add_negative(i, v) (atomic_add_return(i, (v)) < 0) |
|
#define | atomic_inc_return(v) (atomic_add_return(1, v)) |
|
#define | atomic_dec_return(v) (atomic_sub_return(1, v)) |
|
#define atomic_inc_not_zero |
( |
|
v | ) |
atomic_add_unless((v), 1, 0) |
#define ATOMIC_INIT |
( |
|
i | ) |
{ (i) } |
atomic_read - reads a word, atomically : pointer to atomic value
Assumes all word reads on our architecture are atomic.
Definition at line 37 of file atomic.h.
atomic_xchg - atomic : pointer to memory to change : new value (technically passed in a register – see xchg)
Definition at line 44 of file atomic.h.