Messages in this thread | | | Subject | RE: Question on atomic_inc/dec | Date | Wed, 15 Oct 2003 10:38:14 -0700 | From | "Perez-Gonzalez, Inaky" <> |
| |
> From: sankar [mailto:san_madhav@hotmail.com]
> any solution to the original problem??? > (atomic_inc() defintion not there in redhat 9.0 asm/atomic.h)
Create an atomic.h header file in your source tree with the code below, but bear in mind that porting to other arches might be painful:
struct atomic { volatile int i; }
/* Simple atomic increment. */
static inline void atomic_inc (struct atomic *a) { asm volatile ( "lock; incl %0" : "=m" (a->i) : "m" (a->i)); }
/* Simple atomic decrement. */
static inline void atomic_dec (struct atomic *a) { asm volatile ( "lock; decl %0" : "=m" (a->i) : "m" (a->i)); }
Iñaky Pérez-González -- Not speaking for Intel -- all opinions are my own (and my fault)
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |