From owner-cvs-all Thu Oct 5 20:50:43 2000 Delivered-To: cvs-all@freebsd.org Received: from mass.osd.bsdi.com (adsl-63-202-176-106.dsl.snfc21.pacbell.net [63.202.176.106]) by hub.freebsd.org (Postfix) with ESMTP id 82AEF37B503; Thu, 5 Oct 2000 20:50:40 -0700 (PDT) Received: from mass.osd.bsdi.com (localhost [127.0.0.1]) by mass.osd.bsdi.com (8.11.0/8.9.3) with ESMTP id e963qPh04244; Thu, 5 Oct 2000 20:52:26 -0700 (PDT) (envelope-from msmith@mass.osd.bsdi.com) Message-Id: <200010060352.e963qPh04244@mass.osd.bsdi.com> X-Mailer: exmh version 2.1.1 10/15/1999 To: Bruce Evans Cc: cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org Subject: Re: cvs commit: src/sys/alpha/include atomic.h src/sys/i386/incl In-reply-to: Your message of "Fri, 06 Oct 2000 14:27:37 +1100." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 05 Oct 2000 20:52:25 -0700 From: Mike Smith Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > >> Add atomic_readandclear_int and atomic_readandclear_long. > > > > > > Um, isn't this just exchange-with-zero? > > > > That's one way of implementing it, yes. That is not the method used by the > > alpha, however. I chose the name due to prior existence. The alpha > > already had an atomic_readandclear_int, albeit buried in the ipl code. > > The x86 had a similar loadandclear() in cpufunc.h > > It should be named loadandclear(). "load" is more precise than "read". It should be called "atomic_exchange()", and this specific case should be int value = 0; atomic_exchange(value, othervalue); since it's otherwise entirely redundant. > The instruction to do the load is even named "ld" on alphas. I will > remove the suffixes on the atomic functions soon. It should go without > saying that operations like load and clear, test and set, and compare and > swap, etc., are atomic. It doesn't go without saying, and I think it's important from the perspective of general code readability that we make it extremely clear that these methods are explicitly atomic. I'm also strongly in favour of the atomic_t proposal that Alfred put forwards, since in many cases the atomic_*_int calls are used by default where atomic_*_optimal_type would be better. -- ... every activity meets with opposition, everyone who acts has his rivals and unfortunately opponents also. But not because people want to be opponents, rather because the tasks and relationships force people to take different points of view. [Dr. Fritz Todt] V I C T O R Y N O T V E N G E A N C E To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message