lkml.org 
[lkml]   [2003]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRE: Question on atomic_inc/dec
Date
From
> 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/

\
 
 \ /
  Last update: 2005-03-22 13:49    [W:0.030 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site