This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: testandset on powerpc


>>>>> Geoff Keating writes:

>> Cc: libc-hacker@sourceware.cygnus.com
>> From: Andreas Jaeger <aj@suse.de>
>> Date: 18 Jul 2000 17:42:05 +0200

Geoff> It'd be better if the generic code could be written to simply use
Geoff> compare_and_swap if it is available.  That would make porting easier.
>> 
>> Why?  All platforms - except ppc - have testandset.  IMHO porting
>> would be easier if ppc had testandset ;-).

Geoff> I don't understand.  testandset is a specialisation of
Geoff> compare_and_swap.  Every platform which can do compare_and_swap can do
Geoff> testandset.  It's just that the generic code doesn't know this.

Geoff> It shouldn't be necessary for each porter to have to work out how to
Geoff> make compare_and_swap do testandset.  It should just happen.

Since testandset is a specialisation it can be optimized - and that
seems to be the reason why testandset is used here instead of
compare_and_swap.

So what's the right thing to do?  

- Add some define like HAS_TESTANDSET and implement testandset with
  compare_and_swap if testandset is not available?
- Remove testandset completly?

Andreas

P.S. Geoff, your messages don't go to libc-hacker.  It seems that
sourceware still doesn't like your setup.  I've changed from
libc-hacker to libc-alpha to give other the chance to see your reply.

>> testandset is only used in spinlock.c.  Should we document somewhere
>> that and why testandset is deprecated?

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.rhein-neckar.de

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]