|
From: Magnus R. <mag...@gm...> - 2013-11-08 07:20:32
|
On 7 November 2013 18:21, Saurabh T <sa...@ho...> wrote: > ---------------------------------------- >> From: fa...@kd... >> To: val...@li... >> CC: sa...@ho... >> Subject: Re: [Valgrind-users] Helgrind 3.9.0: false positive with pthread_mutex_destroy >> Date: Thu, 7 Nov 2013 17:25:57 +0100 >> >> On Thursday 07 November 2013 16:22:56 Saurabh T wrote: >>> Helgrind seems to be reporting false positive data race when >>> pthread_mutex_destroy is called in a different thread from >>> pthread_mutex_unlock. Unfortunately I cannot make a test case, sorry. But >>> here's the relevant output: >>> <snip> >> >> Can you prove that the destroy cannot happen during the unlock? > > Not without code of course, but I dont believe it can. It can however happen *before* the unlock. I believe this is allowed by the standard? The code is something like this: > Thread 1: > locks > deletes > unlocks > Thread 2: > locks > does_stuff > unlocks > > saurabh > That is most definitely wrong. Thread 1 destroys a locked mutex, and according to http://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_mutex_init.html : > Attempting to destroy a locked mutex results in undefined behavior. BR Magnus Reftel |