Subject: Re: Unlocking an unlocked mutex
To: None <tech-kern@netbsd.org>
From: Joerg Sonnenberger <joerg@britannica.bec.de>
List: tech-kern
Date: 10/12/2005 23:26:37
On Wed, Oct 12, 2005 at 10:21:48PM +0100, David Laight wrote:
> On Wed, Oct 12, 2005 at 11:12:28PM +0200, Joerg Sonnenberger wrote:
> > On Wed, Oct 12, 2005 at 10:12:16PM +0200, Vincent wrote:
> > > I was wondering if unlocking an (already) unlocked mutex *really*
> > > deserves an error, or if it could just be turned into a non-fatal
> > > warning or whatever. Obviously, this is not as critical as trying to
> > > unlock another thread's mutex.
> >
> > In a better world it would actually be fatal. Just think about it,
> > the code has unbalanced critical sections :-)
>
> Indeed, without a core dump the location (in the program) could be hard
> to find.
Well, you could add a generic back trace support to libc and use that.
It doesn't have to work for arbitrary cases, just enough to get the
caller of pthread_mutex_unlock. It would help in a lot of other cases
too.
Joerg