[parisc-linux] Anyone got a few moments?

Jeffrey A Law law@cygnus.com
Mon, 28 Jun 1999 11:47:56 -0600


  In message <19990628193404.I30362@mencheca.ch.genedata.com>you write:
  > > What does xchg() do?
  > 
  > /*
  >  * Atomic [test&set] exchange
  >  *
  >  *      void *xchg_u32(void *ptr, unsigned long val)
  >  * Changes the memory location '*ptr' to be val and returns
  >  * the previous value stored there.
  >  */
  > 
tsk tsk, that is a highly non-portable API for atomic operations.

  > It's atomic with respect to interrupts and other CPUs.
  > 
  > PA-RISC 2.0 seems to have LDC{W,D}, but that's going to make implementation
  > a real pain.
Yes.  Major pain since the only useful atomic operations are load & clear
word/double as you noted.

Why does linux want an "exchange"-like API for atomic operations?  That
just seems totally weird and stupid.


jeff