Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Oct 2001 12:03:30 -0700 (PDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        John Polstra <jdp@polstra.com>
Cc:        Doug Rabson <dfr@nlsystems.com>, ia64@FreeBSD.org
Subject:   RE: rtld -- atomic ops
Message-ID:  <XFMail.011010120330.jhb@FreeBSD.org>
In-Reply-To: <XFMail.011010102350.jdp@polstra.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On 10-Oct-01 John Polstra wrote:
> John Baldwin wrote:
>> 
>> One quick question.  Now that we have a MI atomic operation interface one
>> can
>> get from <machine/atomic.h> that includes atomic_cmpset_acq_int(),
>> atomic_add_acq_int(), and atomic_add_rel_int(), why not use these instead of
>> re-rolling the atomic operations each time?  I realize that do to the quirky
>> nature of the 386, you would still have to have a hack for the x86 platform,
>> but at least for 486+ and other arch's you could just use the pre-existent
>> API
>> so that we only have to code up atomic ops in one place.
>> 
>> Comments?
> 
> That would be great, as far as I'm concerned.  Note, the reader/writer
> locks used by the dynamic linker require something resembling an
> atomic compare and exchange operation.

That's exactly what atomic_cmpset() is. :)  Although it doesn't guarantee an
exchange (i.e., it doesn't return the old value if the cmp succeeds).

> John

-- 

John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ia64" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.011010120330.jhb>