Date: Thu, 8 Apr 2004 23:36:47 +0200 From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: freebsd-arch@freebsd.org Subject: mtx_lock_recurse/mtx_unlock_recurse functions (proof-of-concept). Message-ID: <20040408213647.GL661@darkness.comp.waw.pl>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] Hi. As was discussed, it will be helpful to have functions, that are able to acquire lock recursively, even if lock itself isn't recursable. Here is a patch, that should implement this functionality: http://people.freebsd.org/~pjd/patches/mtx_lock_recurse.patch I also added a KASSERT() to protect against mixed locking modes, e.g.: mtx_lock(&mtx); [...] mtx_lock_recurse(&mtx); [...] mtx_unlock(&mtx); [...] mtx_unlock_recurse(&mtx); This is not permitted, but this should work just fine: mtx_lock(&mtx); [...] mtx_lock_recurse(&mtx); [...] mtx_unlock_recurse(&mtx); [...] mtx_unlock(&mtx); -- Pawel Jakub Dawidek http://www.FreeBSD.org pjd@FreeBSD.org http://garage.freebsd.pl FreeBSD committer Am I Evil? Yes, I Am! [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFAdcXvForvXbEpPzQRAm4AAJ93RZtpHN4byfpwJUr/z3ElvyyW3wCfXkK5 weeNN/NPnvoRJnmk54Xf4PU= =WbaK -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040408213647.GL661>
