From owner-freebsd-arch@FreeBSD.ORG Mon May 24 07:39:05 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3DF2916A4CE for ; Mon, 24 May 2004 07:39:05 -0700 (PDT) Received: from mail6.speakeasy.net (mail6.speakeasy.net [216.254.0.206]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2306643D41 for ; Mon, 24 May 2004 07:39:05 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 6035 invoked from network); 24 May 2004 14:37:53 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 24 May 2004 14:37:53 -0000 Received: from 10.50.40.205 (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.11/8.12.11) with ESMTP id i4OEbgBP098253; Mon, 24 May 2004 10:37:42 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: freebsd-arch@FreeBSD.org Date: Mon, 24 May 2004 10:38:19 -0400 User-Agent: KMail/1.6 References: In-Reply-To: MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200405241038.19589.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on server.baldwin.cx cc: arch@FreeBSD.org cc: mtm@FreeBSD.org cc: Garance A Drosihn cc: Julian Elischer Subject: Re: atomic reference counting primatives. X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 May 2004 14:39:05 -0000 On Friday 21 May 2004 08:44 pm, Garance A Drosihn wrote: > At 1:56 PM -0700 5/20/04, Julian Elischer wrote: > >This has been raised before but I have come across uses for > >it again and again so I'm raising it again. JHB once posted > >some atomic reference counting primitives. (Do you still have > >them John?) Alfred once said he had some somewhere too, and > >others have commented on this before, but we still don't seem > >to have any. > > Btw, does this thread have anything to do with the present > buuldworld-breakage for sparc64? I notice the compile-time > errors are something like: No. > /usr/src/lib/libthr/thread/thr_cancel.c: In function `testcancel': > /usr/src/lib/libthr/thread/thr_cancel.c:123: warning: passing > arg 1 of `atomic_cmpset_int' from incompatible pointer type > > My guess is that this is related to Mike's change to "Make libthr > async-signal-safe without costly signal masking. [...etc...]". > > This breakage underlines one reason that it would be mighty > convenient to have some "official" set of primitives. It is > one thing if a developer has to roll-their-own solution for > i386, but somewhat more challenging if that solution has to > work across a half-dozen different hardware platforms. atomic_cmpset() is an "official" primitive. The problem is that Mike is using an enum and assuming that all enum's are ints which is not necessarily true. The code should perhaps use an int with #define's instead to guarantee that the variable is an int and not a short, char, or long. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org