Date: Wed, 3 Aug 2005 13:21:31 -0400 From: John Baldwin <jhb@FreeBSD.org> To: freebsd-hackers@freebsd.org, hselasky@c2i.net Subject: Re: How to do proper locking Message-ID: <200508031321.32276.jhb@FreeBSD.org> In-Reply-To: <200508030023.04748.hselasky@c2i.net> References: <200508030023.04748.hselasky@c2i.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 02 August 2005 06:23 pm, Hans Petter Selasky wrote: > Hi, > > I am looking for a safe way to access structures that can be freed. The > solution I am looking for must not: > > - hinder scaleability > - lead to use of a single lock > - lead to lock order reversal These aren't a very clear set of requirements. Note that you can't hold a lock across malloc(), so your allocation code isn't safe. You can try taking at look at some existing refcounted structures such as ucreds, p_args, etc. or looking at structures held in a global list like proc. What actual problem are you trying to solve? How does code obtain references to my_struct objects? Are they hung off another object that has a lock? Are they in a global list? -- 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?200508031321.32276.jhb>