]> git.sesse.net Git - vlc/commitdiff
Error checks in debug mode : pthread ERRORCHECK_MUTEX and MALLOC_CHECK_=2.
authorChristophe Massiot <massiot@videolan.org>
Mon, 1 Oct 2001 12:48:01 +0000 (12:48 +0000)
committerChristophe Massiot <massiot@videolan.org>
Mon, 1 Oct 2001 12:48:01 +0000 (12:48 +0000)
Makefile
include/threads.h
src/interface/main.c

index 336b9b1328f604e0186c43c7b6b1b88c97aa117a..e8d6645944c2f63382218f68f59a33dcdedd20ee 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -174,7 +174,7 @@ endif
        $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
 
 vlc-uninstall:
-       rm vlc $(DESTDIR)$(bindir)/vlc
+       rm $(DESTDIR)$(bindir)/vlc
 ifneq (,$(ALIASES))
        for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
 endif
index 79159a4ec34f4b0b504a712c27ac5a5660954d21..ea684e56bb3bdecd02bf53e4c47aa80653bf3a2e 100644 (file)
@@ -3,7 +3,7 @@
  * This header provides a portable threads implementation.
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: threads.h,v 1.24 2001/08/19 23:35:13 sam Exp $
+ * $Id: threads.h,v 1.25 2001/10/01 12:48:01 massiot Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@via.ecp.fr>
@@ -34,6 +34,8 @@
 
 #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )  /* pthreads (like Linux & BSD) */
 #   include <pthread.h>
+/* This is not prototyped under Linux, though it exists. */
+int pthread_mutexattr_setkind_np( pthread_mutexattr_t *attr, int kind );
 
 #elif defined( HAVE_CTHREADS_H )                                  /* GNUMach */
 #   include <cthreads.h>
@@ -267,6 +269,18 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex )
     return pth_mutex_init( p_mutex );
 
 #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
+#   if defined(DEBUG) && defined(SYS_LINUX)
+    /* Create error-checking mutex to detect threads problems more easily. */
+    pthread_mutexattr_t attr;
+    int                 i_result;
+
+    pthread_mutexattr_init( &attr );
+    pthread_mutexattr_setkind_np( &attr, PTHREAD_MUTEX_ERRORCHECK_NP );
+    i_result = pthread_mutex_init( p_mutex, &attr );
+    pthread_mutexattr_destroy( &attr );
+    return( i_result );
+#   endif
+
     return pthread_mutex_init( p_mutex, NULL );
 
 #elif defined( HAVE_CTHREADS_H )
index 7e383c6501448a45bc7b0cceb40120d5fc21bb04..5326f1ce44d7f12965bf6162d55f15c2e45590d8 100644 (file)
@@ -4,7 +4,7 @@
  * and spawn threads.
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: main.c,v 1.114 2001/09/25 11:46:14 massiot Exp $
+ * $Id: main.c,v 1.115 2001/10/01 12:48:01 massiot Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -289,8 +289,15 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
      */
 #if defined( SYS_BEOS ) || defined( SYS_DARWIN )
     system_Init( &i_argc, ppsz_argv, ppsz_env );
+
 #elif defined( WIN32 )
     _fmode = _O_BINARY;   /* sets the default file-translation mode on Win32 */
+
+#elif defined( SYS_LINUX )
+#   ifdef DEBUG
+    /* Activate malloc checking routines to detect heap corruptions. */
+    main_PutIntVariable( "MALLOC_CHECK_", 2 );
+#   endif
 #endif
 
     /*