Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros
atomic.h File Reference
#include <asm/cmpxchg.h>
#include <linux/compiler.h>
#include <linux/types.h>
#include <asm/atomic_32.h>

Go to the source code of this file.

Macros

#define ATOMIC_INIT(i)   { (i) }
 
#define atomic_sub_return(i, v)   atomic_add_return((int)(-(i)), (v))
 
#define atomic_sub(i, v)   atomic_add((int)(-(i)), (v))
 
#define atomic_sub_and_test(i, v)   (atomic_sub_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(v)   atomic_add(1, (v))
 
#define atomic_dec(v)   atomic_sub(1, (v))
 
#define atomic_dec_and_test(v)   (atomic_dec_return(v) == 0)
 
#define atomic_inc_and_test(v)   (atomic_inc_return(v) == 0)
 
#define atomic_add_negative(i, v)   (atomic_add_return((i), (v)) < 0)
 

Macro Definition Documentation

#define atomic_add_negative (   i,
  v 
)    (atomic_add_return((i), (v)) < 0)

atomic_add_negative - add and test if negative : pointer of type atomic_t : integer value to add

Atomically adds to and returns true if the result is negative, or false when result is greater than or equal to zero.

Definition at line 124 of file atomic.h.

#define atomic_dec (   v)    atomic_sub(1, (v))

atomic_dec - decrement atomic variable : pointer of type atomic_t

Atomically decrements by 1.

Definition at line 98 of file atomic.h.

#define atomic_dec_and_test (   v)    (atomic_dec_return(v) == 0)

atomic_dec_and_test - decrement and test : pointer of type atomic_t

Atomically decrements by 1 and returns true if the result is 0.

Definition at line 106 of file atomic.h.

#define atomic_dec_return (   v)    atomic_sub_return(1, (v))

atomic_dec_return - decrement memory and return : pointer of type atomic_t

Atomically decrements by 1 and returns the new value.

Definition at line 82 of file atomic.h.

#define atomic_inc (   v)    atomic_add(1, (v))

atomic_inc - increment atomic variable : pointer of type atomic_t

Atomically increments by 1.

Definition at line 90 of file atomic.h.

#define atomic_inc_and_test (   v)    (atomic_inc_return(v) == 0)

atomic_inc_and_test - increment and test : pointer of type atomic_t

Atomically increments by 1 and returns true if the result is 0.

Definition at line 114 of file atomic.h.

#define atomic_inc_return (   v)    atomic_add_return(1, (v))

atomic_inc_return - increment memory and return : pointer of type atomic_t

Atomically increments by 1 and returns the new value.

Definition at line 74 of file atomic.h.

#define ATOMIC_INIT (   i)    { (i) }

Definition at line 27 of file atomic.h.

#define atomic_sub (   i,
  v 
)    atomic_add((int)(-(i)), (v))

atomic_sub - subtract integer from atomic variable : integer value to subtract : pointer of type atomic_t

Atomically subtracts from .

Definition at line 56 of file atomic.h.

#define atomic_sub_and_test (   i,
  v 
)    (atomic_sub_return((i), (v)) == 0)

atomic_sub_and_test - subtract value from variable and test result : integer value to subtract : pointer of type atomic_t

Atomically subtracts from and returns true if the result is zero, or false for all other cases.

Definition at line 66 of file atomic.h.

#define atomic_sub_return (   i,
  v 
)    atomic_add_return((int)(-(i)), (v))

atomic_sub_return - subtract integer and return : pointer of type atomic_t : integer value to subtract

Atomically subtracts from and returns -

Definition at line 47 of file atomic.h.