public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* atomic.h vs spinlock.h
@ 2003-06-20 23:00 Umut Aymakoglu
  2003-06-20 23:08 ` David Mosberger
  0 siblings, 1 reply; 2+ messages in thread
From: Umut Aymakoglu @ 2003-06-20 23:00 UTC (permalink / raw)
  To: linux-ia64





Hi -
   2 questions actually:

1) what is the difference between the macros defined in asm/atomic.h and
asm/spinlock.h. (usage and purpose wise)?

2) If I need to use asm/atomic.h, which macro can I use to test-and-set?


thanks,
Umut


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: atomic.h vs spinlock.h
  2003-06-20 23:00 atomic.h vs spinlock.h Umut Aymakoglu
@ 2003-06-20 23:08 ` David Mosberger
  0 siblings, 0 replies; 2+ messages in thread
From: David Mosberger @ 2003-06-20 23:08 UTC (permalink / raw)
  To: linux-ia64

>>>>> On Fri, 20 Jun 2003 16:00:45 -0700, Umut Aymakoglu <umuta@us.ibm.com> said:

  Umut> 1) what is the difference between the macros defined in
  Umut> asm/atomic.h and asm/spinlock.h. (usage and purpose wise)?

The first provides atomic operations, such as increment and decrement;
the second provides spinlocks.  I'm afraid I'm just stating the
obvious here.

In case you have a copy of my book (ia64 linux kernel), atomic ops and
spinlocks are described in sections 3.3.2 and 3.3.5, respectively.
(Of course, I wouldn't recommend to get the book _just_ because of
this.)

  Umut> 2) If I need to use asm/atomic.h, which macro can I use to
  Umut> test-and-set?

cmpxchg() is the closest thing to test-and-set.  Not all platforms support it.
Platforms that do support it (such as ia64), define macro __HAVE_ARCH_CMPXCHG.

	--david

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-06-20 23:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-20 23:00 atomic.h vs spinlock.h Umut Aymakoglu
2003-06-20 23:08 ` David Mosberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox