Atomic operations are guaranteed to be serialized, no need of locks for protection against concurrent access between threads (threads of execution). These operations are used to perform lightweight one-shot operations such as to set the bit positions, bumping counters and conditional increments.
Atomic Integer Operation Description
ATOMIC_INIT(int I) At declaration, initialize an atomic_t to I
void atomic_set(atomic_t *v, int I) Atomically set v equal to I
void atomic_inc(atomic_t *v) Atomically add one to v
void atomic_dec(atomic_t *v) Atomically subtract one from v
int atomic_read(atomic_t *v) Atomically read the integer value of v
void atomic_add(int i, atomic_t *v) Atomically add i to v
void atomic_sub(int i, atomic_t *v) Atomically subtract i from v
int atomic_sub_and_test(int i, atomic_t *v) Atomically subtract i from v and return
true if the result is zero; otherwise false
int atomic_add_negative(int i,atomic_t *v) Atomically add i to v and return true if the
result is negative; otherwise false
int atomic_dec_and_test(atomic_t *v) Atomically decrement v by one and return
true if zero; false otherwise
int atomic_inc_and_test(atomic_t *v) Atomically increment v by one and return
true if the result is zero; false otherwise
The implementation of atomic operators is architecture-dependent.