%PDF- %PDF-
Direktori : /usr/src/kernels/2.6.32-754.30.2.el6.x86_64/include/linux/ |
Current File : //usr/src/kernels/2.6.32-754.30.2.el6.x86_64/include/linux/atomic.h |
#ifndef _LINUX_ATOMIC_H #define _LINUX_ATOMIC_H #include <asm/atomic.h> /* * atomic_dec_if_positive - decrement by 1 if old value positive * @v: pointer of type atomic_t * * The function returns the old value of *v minus 1, even if * the atomic variable, v, was not decremented. */ #ifndef atomic_dec_if_positive static inline int atomic_dec_if_positive(atomic_t *v) { int c, old, dec; c = atomic_read(v); for (;;) { dec = c - 1; if (unlikely(dec < 0)) break; old = atomic_cmpxchg((v), c, dec); if (likely(old == c)) break; c = old; } return dec; } #endif #endif /* _LINUX_ATOMIC_H */