From owner-freebsd-threads@FreeBSD.ORG Fri Apr 18 10:53:10 2003 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 805B637B405; Fri, 18 Apr 2003 10:53:10 -0700 (PDT) Received: from stork.mail.pas.earthlink.net (stork.mail.pas.earthlink.net [207.217.120.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id DA90143FB1; Fri, 18 Apr 2003 10:53:09 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from pool0577.cvx22-bradley.dialup.earthlink.net ([209.179.200.67] helo=mindspring.com) by stork.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 196a2u-0001jw-00; Fri, 18 Apr 2003 10:53:09 -0700 Message-ID: <3EA03B31.A6D1D83E@mindspring.com> Date: Fri, 18 Apr 2003 10:51:45 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Robert Watson References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a4c525a484888e1861d438fdefa02e04ff350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c cc: freebsd-threads@freebsd.org cc: David Xu cc: Daniel Eischen Subject: Re: libpthread patch X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Apr 2003 17:53:10 -0000 Robert Watson wrote: > On Fri, 18 Apr 2003, Terry Lambert wrote: > > You are allowed to recurse on a mutex in the kernel, because there's > > some depth to code paths that shouldn't be there, but it's easier to > > allow recursion than it is to correct the code. > > By default, mutexes are not permitted to be recursed, and recursing them > will cause a panic. Recursion is only permitted if the MTX_RECURSE flag > is set at mutex initialization time, which is strongly discouraged. I should have said that "the potential is there, and it's used". The best way to discourage recursion, of course, is to remove the capability. I wish you had commented on the issue of introducing hierarchy into lock acquisition; witness effectively enforces the first hierarchy that occurs, thereafter, but only on a per locking entity basis, and not in the circumstances I described, e.g.: acquire: mutex1(a) mutex2 mutex1(b), release mutex1(a). -- Terry