Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 May 2004 10:38:19 -0400
From:      John Baldwin <jhb@FreeBSD.org>
To:        freebsd-arch@FreeBSD.org
Cc:        Julian Elischer <julian@elischer.org>
Subject:   Re: atomic reference counting primatives.
Message-ID:  <200405241038.19589.jhb@FreeBSD.org>
In-Reply-To: <p06020404bcd44faaef2f@[128.113.24.47]>
References:  <Pine.BSF.4.21.0405201340590.72391-100000@InterJet.elischer.org> <p06020404bcd44faaef2f@[128.113.24.47]>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



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