From owner-freebsd-arch@FreeBSD.ORG Thu Apr 8 14:36:48 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DDA3316A4CE for ; Thu, 8 Apr 2004 14:36:48 -0700 (PDT) Received: from darkness.comp.waw.pl (darkness.comp.waw.pl [195.117.238.236]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8240243D1D for ; Thu, 8 Apr 2004 14:36:48 -0700 (PDT) (envelope-from pjd@darkness.comp.waw.pl) Received: by darkness.comp.waw.pl (Postfix, from userid 1009) id 0BA64ACAEB; Thu, 8 Apr 2004 23:36:47 +0200 (CEST) Date: Thu, 8 Apr 2004 23:36:47 +0200 From: Pawel Jakub Dawidek To: freebsd-arch@freebsd.org Message-ID: <20040408213647.GL661@darkness.comp.waw.pl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0+35XlDF45POFHfm" Content-Disposition: inline User-Agent: Mutt/1.4.2i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 5.2.1-RC2 i386 Subject: mtx_lock_recurse/mtx_unlock_recurse functions (proof-of-concept). X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2004 21:36:49 -0000 --0+35XlDF45POFHfm Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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); --=20 Pawel Jakub Dawidek http://www.FreeBSD.org pjd@FreeBSD.org http://garage.freebsd.pl FreeBSD committer Am I Evil? Yes, I Am! --0+35XlDF45POFHfm Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFAdcXvForvXbEpPzQRAm4AAJ93RZtpHN4byfpwJUr/z3ElvyyW3wCfXkK5 weeNN/NPnvoRJnmk54Xf4PU= =WbaK -----END PGP SIGNATURE----- --0+35XlDF45POFHfm--