libpthread patch

Terry Lambert tlambert2 at mindspring.com
Fri Apr 18 10:53:10 PDT 2003


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


More information about the freebsd-threads mailing list