Date: Sat, 06 Aug 2005 17:02:16 +0100 From: Ian Dowse <iedowse@iedowse.com> To: hselasky@c2i.net Cc: freebsd-hackers@freebsd.org Subject: Re: How to do proper locking Message-ID: <200508061702.aa50464@nowhere.iedowse.com> In-Reply-To: Your message of "Sat, 06 Aug 2005 01:39:55 %2B0200." <200508060139.57143.hselasky@c2i.net>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <200508060139.57143.hselasky@c2i.net>, Hans Petter Selasky writes: >Yes, you are right, but the problem is, that for most callback systems in the >kernel, there is no mechanism that will pre-lock some custom mutex before >calling the callback. > >I am not speaking about adding lines to existing code, but to add one extra >parameter to the setup functions, where the mutex that should be locked >before calling the callback(s) can be specified. If it is NULL, Giant will be >used. > >The setup functions I have in mind are for example: "make_dev()", >"bus_setup_intr()", "callout_reset()" ... and in general all callback systems >that look like these. Note that FreeBSD's callout subsystem does already have such a mechanism. Just use callout_init_mtx() and the specified mutex will be acquired before the callback is invoked. See callout(9) for more details. Ian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200508061702.aa50464>