Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Apr 2003 06:50:12 -0400 (EDT)
From:      Robert Watson <rwatson@freebsd.org>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        Daniel Eischen <eischen@pcnet1.pcnet.com>
Subject:   Re: libpthread patch
Message-ID:  <Pine.NEB.3.96L.1030418063854.24445U-100000@fledge.watson.org>
In-Reply-To: <3E9FAE89.4D656F38@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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.  There
are several mutex in the kernel where the flag is set, but I hope to see
the list remain small (and go down).  A quick grep of of kern shows four
classes of mutexes with MTX_RECURSE set (one is Giant), and 57 without
(approximately).  The IP stack locking, on the other hand, has four mutex
classes, of which two permit recursion (PCB locks).

Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
robert@fledge.watson.org      Network Associates Laboratories




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1030418063854.24445U-100000>