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

Go to the source code of this file.

Macros

#define ATOMIC_INIT(i)   { (i) }
 
#define atomic_read(v)   (*(volatile int *)&(v)->counter)
 
#define atomic_set(v, i)   (((v)->counter) = i)
 
#define atomic_xchg(v, new)   (xchg(&((v)->counter), new))
 
#define atomic_cmpxchg(v, o, n)   (cmpxchg(&((v)->counter), (o), (n)))
 
#define atomic_sub(i, v)   (void)atomic_sub_return(i, v)
 
#define atomic_add(i, v)   (void)atomic_add_return(i, v)
 
#define atomic_dec(v)   atomic_sub(1, (v))
 
#define atomic_inc(v)   atomic_add(1, (v))
 
#define atomic_dec_return(v)   atomic_sub_return(1, v)
 
#define atomic_inc_return(v)   atomic_add_return(1, v)
 
#define atomic_sub_and_test(i, v)   (atomic_sub_return(i, v) == 0)
 
#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_add_negative(i, v)   (atomic_add_return(i, v) < 0)
 
#define atomic_dec_if_positive(v)   atomic_sub_if_positive(1, v)
 
#define smp_mb__before_atomic_dec()   barrier()
 
#define smp_mb__after_atomic_dec()   barrier()
 
#define smp_mb__before_atomic_inc()   barrier()
 
#define smp_mb__after_atomic_inc()   barrier()
 

Macro Definition Documentation

#define atomic_add (   i,
  v 
)    (void)atomic_add_return(i, v)

Definition at line 172 of file atomic.h.

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

Definition at line 182 of file atomic.h.

#define atomic_cmpxchg (   v,
  o,
  n 
)    (cmpxchg(&((v)->counter), (o), (n)))

Definition at line 169 of file atomic.h.

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

Definition at line 173 of file atomic.h.

#define atomic_dec_and_test (   v)    (atomic_sub_return(1, v) == 0)

Definition at line 181 of file atomic.h.

#define atomic_dec_if_positive (   v)    atomic_sub_if_positive(1, v)

Definition at line 184 of file atomic.h.

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

Definition at line 176 of file atomic.h.

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

Definition at line 174 of file atomic.h.

#define atomic_inc_and_test (   v)    (atomic_add_return(1, v) == 0)

Definition at line 180 of file atomic.h.

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

Definition at line 177 of file atomic.h.

#define ATOMIC_INIT (   i)    { (i) }

Definition at line 20 of file atomic.h.

#define atomic_read (   v)    (*(volatile int *)&(v)->counter)

Definition at line 22 of file atomic.h.

#define atomic_set (   v,
  i 
)    (((v)->counter) = i)

Definition at line 23 of file atomic.h.

#define atomic_sub (   i,
  v 
)    (void)atomic_sub_return(i, v)

Definition at line 171 of file atomic.h.

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

Definition at line 179 of file atomic.h.

#define atomic_xchg (   v,
  new 
)    (xchg(&((v)->counter), new))

Definition at line 168 of file atomic.h.

#define smp_mb__after_atomic_dec ( )    barrier()

Definition at line 187 of file atomic.h.

#define smp_mb__after_atomic_inc ( )    barrier()

Definition at line 189 of file atomic.h.

#define smp_mb__before_atomic_dec ( )    barrier()

Definition at line 186 of file atomic.h.

#define smp_mb__before_atomic_inc ( )    barrier()

Definition at line 188 of file atomic.h.