Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Nov 2001 15:57:52 -0800 (PST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Matthew Dillon <dillon@apollo.backplane.com>
Cc:        freebsd-arch@FreeBSD.org, Robert Watson <rwatson@FreeBSD.org>, Terry Lambert <tlambert2@mindspring.com>
Subject:   Re: cur{thread/proc}, or not.
Message-ID:  <XFMail.011112155752.jhb@FreeBSD.org>
In-Reply-To: <200111122350.fACNojg07127@apollo.backplane.com>

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

On 12-Nov-01 Matthew Dillon wrote:
>     You want to be very careful not to bloat the concept.  We
>     already have severe bloatage in the mutex code and that has
>     led to a lot of unnecessary complexity.  A huge amount,
>     in fact.  We have so many types of mutexes it makes my
>     head spin and I'm not very happy about it.  Forget about 
>     'shared' verses 'exclusive'.  A reference count is a 
>     reference count, that's all.  If you keep the concept
>     simple you can implement more functionality horizontally
>     rather then implementing more complexity vertically.

Err, hang on.  I wasn't doing shared counts.   refcount_shared() would be a
simple primitive to return true if the refcount was > 1.  I was trying to see
how the current API would fit with ucred mutexes, for example.  If you had
looked at the patch, you would find that the API is very simple.  What I really
should do is add atomic_fetchadd()  (fetchadd on ia64, xadd on 486+, locked
load /conditional store loop on alpha, simualted with atomic_cmpset() on opther
archs if needed) and refcount_drop() can just be atomic_fetchadd().  This will
change refcount_drop() to return the current value rather than if the value is
zero.  Please reread my mail and the patch itself.

-- 

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-arch" in the body of the message




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