[vlc-devel] commit: Don't try to lock locked mutexes under valgrind ( Rémi Denis-Courmont )

git version control git at videolan.org
Mon Apr 13 22:42:03 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Apr 13 23:40:22 2009 +0300| [2479ed41be5ed11c56ec64df14ec389e23a29e87] | committer: Rémi Denis-Courmont 

Don't try to lock locked mutexes under valgrind

This removes a lot of false true positives.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2479ed41be5ed11c56ec64df14ec389e23a29e87
---

 src/misc/threads.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/misc/threads.c b/src/misc/threads.c
index 2b13262..c0bf8fd 100644
--- a/src/misc/threads.c
+++ b/src/misc/threads.c
@@ -357,8 +357,16 @@ void vlc_mutex_destroy (vlc_mutex_t *p_mutex)
 }
 
 #if defined(LIBVLC_USE_PTHREAD) && !defined(NDEBUG)
+# ifdef HAVE_VALGRIND_VALGRIND_H
+#  include <valgrind/valgrind.h>
+# else
+#  define RUNNING_ON_VALGRIND (0)
+# endif
+
 void vlc_assert_locked (vlc_mutex_t *p_mutex)
 {
+    if (RUNNING_ON_VALGRIND > 0)
+        return;
     assert (pthread_mutex_lock (p_mutex) == EDEADLK);
 }
 #endif




More information about the vlc-devel mailing list