Subject: Re: Unlocking an unlocked mutex
To: Vincent <10.50@free.fr>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-kern
Date: 10/14/2005 09:19:58
On Oct 12, 2005, at 2:14 PM, Vincent wrote:

> Rui Paulo a =E9crit :
>
>> 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 =20
> obviously NOT correct, is it, for example, more critical than to =20
> free an already freed chunck of memory? The latter case is, as far =20
> as I know, (quite always) treated as a warning and not as an error=85

Really, they're both critical errors that should cause apps to abort.

Releasing an unlocked mutex -- your data structures were not locked =20
even though you thought they were, could lead to corruption of those =20
structures.

Freeing already freed memory -- your app is using memory that someone =20=

else could come along and allocate, leading to corruption of that data.


>
> Vincent

-- thorpej