Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 01 Feb 2001 10:52:04 -0800
From:      Julian Elischer <julian@elischer.org>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        freebsd-hackers@FreeBSD.org, Matthew Emmerton <matt@gsicomp.on.ca>
Subject:   Re: Atomic bit operations
Message-ID:  <3A79B054.BB13FA83@elischer.org>
References:  <XFMail.010201094914.jhb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
John Baldwin wrote:
> 

> 
> The current implementation for it can be found at
> http://www.FreeBSD.org/~jhb/patches/refcount.patch.  It's all done with simple
> atomic operations right now.
> 

what I do at the moment is:
                                
        do {
                v = node->nd_refs;
        } while (! atomic_cmpset_int(&node->nd_refs, v, v - 1));

        if (v == 1) { /* we were the last */
	       .......whatever needs to be done
	}

but I'd rather have something more 'direct'

-- 
      __--_|\  Julian Elischer
     /       \ julian@elischer.org
    (   OZ    ) World tour 2000-2001
---> X_.---._/  
            v


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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