Subject: Re: Unlocking an unlocked mutex
To: Vincent <>
From: Bill Studenmund <>
List: tech-kern
Date: 10/13/2005 09:31:30
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Oct 12, 2005 at 11:14:43PM +0200, Vincent wrote:
> Rui Paulo a ??crit :
> >Unlocking an unlocked mutex is, obviously, not correct :-) The point
> >of that message is to detect mutex problems.
> >You can ignore it by setting the environmental variable
> >PTHREAD_DIAGASSERT to 'A'. See pthread(3) for more info.
> Yep, that's what I did. But, if I admit gracefully that it is obviously=
> NOT correct, is it, for example, more critical than to free an already=20
> freed chunck of memory? The latter case is, as far as I know, (quite=20
> always) treated as a warning and not as an error???

My day job is writing an application that uses pthreads. These assertions=
REALLY help. The problem with unlocking an unlocked mutex is that you most=
likely just finished modifying data that another thread thought _it_ had=20
exclusive access to. You can end up with problems showing up in whatever=20
code goes to use the unprotected data, so the end error looks like it's=20
miles away from where the bug is.

Take care,


Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.2.3 (NetBSD)