From owner-freebsd-hackers Wed Jan 31 23:48:23 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from urban.iinet.net.au (urban.iinet.net.au [203.59.24.231]) by hub.freebsd.org (Postfix) with ESMTP id 8CE0437B491; Wed, 31 Jan 2001 23:48:02 -0800 (PST) Received: from elischer.org (reggae-18-200.nv.iinet.net.au [203.59.80.200]) by urban.iinet.net.au (8.8.7/8.8.7) with ESMTP id PAA08832; Thu, 1 Feb 2001 15:47:56 +0800 Message-ID: <3A791493.FC414DEB@elischer.org> Date: Wed, 31 Jan 2001 23:47:31 -0800 From: Julian Elischer X-Mailer: Mozilla 4.7 [en] (X11; U; FreeBSD 5.0-CURRENT i386) X-Accept-Language: en, hu MIME-Version: 1.0 To: John Baldwin Cc: Matthew Emmerton , freebsd-hackers@FreeBSD.org Subject: Re: Atomic bit operations References: Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG John Baldwin wrote: > > On 31-Jan-01 Matthew Emmerton wrote: > > Hi all, > > > > I've taken a look around for an implementation of atomic bit operations in > > FreeBSD (similar to Linux' asm/bitopt.h, which include clear_bit() and > > test_and_set_bit()) but haven't found any. The only thing I've found are > > the atomic clear/set/add/sub routines in machine/atomic.h. > > > > Do we have an implementation of atomic bit operations, and if we don't, > > would we like some? > > Erm, atomic_set() sets's bits, and atomic_clear() clear's bits. Anything else > you might need can be done with atomic_cmpset() anyways. Also, atomic > operations are very hard to debug, esp. to check for race conditions, so there > direct use is discouraged. Instead, use a higher level primitive such as a > mutex or other appropriate lock. There is also talk of a potential abstract > refcount type so that simple reference counts can be optimized, though that has > been shot down thus far. by who?? I really want this.... > > > -- > > Matt Emmerton > > -- > > John Baldwin -- 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-hackers" in the body of the message -- __--_|\ Julian Elischer / \ julian@elischer.org ( OZ ) World tour 2000-2001 ---> X_.---._/ v To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message