From owner-cvs-all@FreeBSD.ORG Wed Jun 9 16:29:28 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4AAE916A4CE; Wed, 9 Jun 2004 16:29:28 +0000 (GMT) Received: from imap.univie.ac.at (mailbox-lmtp.univie.ac.at [131.130.1.27]) by mx1.FreeBSD.org (Postfix) with ESMTP id B4EEC43D48; Wed, 9 Jun 2004 16:29:27 +0000 (GMT) (envelope-from le@FreeBSD.org) Received: from wireless (adslle.cc.univie.ac.at [131.130.102.11]) by imap.univie.ac.at (8.12.10/8.12.10) with ESMTP id i59GStCh1197358; Wed, 9 Jun 2004 18:29:00 +0200 Date: Wed, 9 Jun 2004 18:28:57 +0200 (CEST) From: Lukas Ertl To: Poul-Henning Kamp In-Reply-To: <55929.1086798000@critter.freebsd.dk> Message-ID: <20040609182606.X707@korben.in.tern> References: <55929.1086798000@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-DCC-ZID-Univie-Metrics: mx8 4247; Body=5 Fuz1=5 Fuz2=5 cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org cc: "M. Warner Losh" Subject: Re: cvs commit: src/sys/kern kern_proc.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jun 2004 16:29:28 -0000 On Wed, 9 Jun 2004, Poul-Henning Kamp wrote: > Assume foo->refcount = 2; > > thread1 (low priority) thread2 (high priority) > ---------------------- ----------------------- > > ... ... > LOCK(foo->lock) ... > i = --foo->refcount; LOCK(foo->lock) > # i == 1, refcount == 1 > UNLOCK(foo->lock) > i = --foo->refcount; > # i == 0, refcount == 0 > UNLOCK(foo->lock) > if (i == 0) # true > destroy(foo) > ... > > if (i == 0) # false > destroy(foo) Is there a possibility that foo->refcount is incremented after both of them left the critical section, so that i is 0, but foo->refcount isn't? cheers, le -- Lukas Ertl http://homepage.univie.ac.at/l.ertl/ le@FreeBSD.org http://people.freebsd.org/~le/