Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Sep 2004 14:09:25 -0400
From:      John Baldwin <jhb@FreeBSD.org>
To:        freebsd-current@FreeBSD.org
Cc:        current@FreeBSD.org
Subject:   Re: Unit number allocation API
Message-ID:  <200409301409.25904.jhb@FreeBSD.org>
In-Reply-To: <37648.1096528007@critter.freebsd.dk>
References:  <37648.1096528007@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



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