In article <local.mail.freebsd-net/[EMAIL PROTECTED]> you
write:
><<On Tue, 12 Dec 2000 17:59:37 -0800, Alfred Perlstein
><[EMAIL PROTECTED]> said:
>
>> Actually, in truth I think you can get the code right like so:
>
>> long x = _mmm->m_ext.ref_cnt->refcnt;
>> while (!atomic_cmpset_long(&_mmm->m_ext.ref_cnt->refcnt, x - 1, x))
>> ;
>
>Cool! You've just (almost) reinvented non-blocking parallel
>reference-counts. Of course, what you really need is:
>
>long
>atomic_decrement_long(long *where)
>{
> long oldval;
>
> do {
> oldval = *where;
> } while (compare_exchange(where, &oldval, oldval - 1) != FAILURE);
Gee, this looks suspiciously like jhb's refcount patch:
+static __inline int
+refcount_release(refcount_t *count)
+{
+ int value;
+
+ do {
+ value = *count - 1;
+ } while (!atomic_cmpset_rel_int(count, value + 1, value));
+ return (value == 0);
+}
Sure you haven't been peeking at it? :-) :-) :-)
--
Jonathan
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message