Date: Wed, 09 Jun 2004 18:40:42 +0200 From: "Poul-Henning Kamp" <phk@phk.freebsd.dk> To: Doug Rabson <dfr@nlsystems.com> Cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/kern kern_proc.c Message-ID: <56221.1086799242@critter.freebsd.dk> In-Reply-To: Your message of "Wed, 09 Jun 2004 17:25:00 BST." <1086798299.12306.3.camel@builder02.qubesoft.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <1086798299.12306.3.camel@builder02.qubesoft.com>, Doug Rabson write s: >> GOOD: >> >> LOCK(foo->lock) >> i = --foo->refcount; >> UNLOCK(foo->lock) >> if (i == 0) >> destroy(foo); > >Isn't there still a race in the GOOD case here if somone takes a new >reference, incrementing refcount after the UNLOCK(foo->lock)? Convetionally, once the refcount==0 it means that nobody will reference it anymore. If you violate this by design (like for instance in the vnode cache), then you need to cope with that problem, and things get ugly fast (like for instance in the vnode cache). -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?56221.1086799242>