From owner-freebsd-current@FreeBSD.ORG Thu Sep 30 18:48:07 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6B62A16A4CE for ; Thu, 30 Sep 2004 18:48:07 +0000 (GMT) Received: from mail5.speakeasy.net (mail5.speakeasy.net [216.254.0.205]) by mx1.FreeBSD.org (Postfix) with ESMTP id 29C9B43D31 for ; Thu, 30 Sep 2004 18:48:07 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: (qmail 29171 invoked from network); 30 Sep 2004 18:48:06 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 30 Sep 2004 18:48:06 -0000 Received: from [10.50.40.210] (gw1.twc.weather.com [216.133.140.1]) (authenticated bits=0) by server.baldwin.cx (8.12.11/8.12.11) with ESMTP id i8UIm2nL020107; Thu, 30 Sep 2004 14:48:02 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: freebsd-current@FreeBSD.org Date: Thu, 30 Sep 2004 14:09:25 -0400 User-Agent: KMail/1.6.2 References: <37648.1096528007@critter.freebsd.dk> In-Reply-To: <37648.1096528007@critter.freebsd.dk> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200409301409.25904.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on server.baldwin.cx cc: Poul-Henning Kamp cc: current@FreeBSD.org Subject: Re: Unit number allocation API X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2004 18:48:07 -0000 On Thursday 30 September 2004 03:06 am, Poul-Henning Kamp wrote: > I had this one out on arch@ previously. I'm very interested in informed > feedback on how we deal with locking for service api's like this. I would suggest that the caller should ask for a unit before it needs a lock and if it finds that it doesn't need the unit after all it can give it back in the error handling. That is, this is similar to malloc'ing a structure up front, then grabbing locks and making changes, then after releasing the lock free'ing the structure if it turned out we didn't need it. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org