Commit e6a8d661 authored by Christophe Massiot's avatar Christophe Massiot
Browse files

Error checks in debug mode : pthread ERRORCHECK_MUTEX and MALLOC_CHECK_=2.

parent d8797a48
...@@ -174,7 +174,7 @@ endif ...@@ -174,7 +174,7 @@ endif
$(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
vlc-uninstall: vlc-uninstall:
rm vlc $(DESTDIR)$(bindir)/vlc rm $(DESTDIR)$(bindir)/vlc
ifneq (,$(ALIASES)) ifneq (,$(ALIASES))
for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
endif endif
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* This header provides a portable threads implementation. * This header provides a portable threads implementation.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * 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> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr> * Samuel Hocevar <sam@via.ecp.fr>
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) /* pthreads (like Linux & BSD) */ #elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) /* pthreads (like Linux & BSD) */
# include <pthread.h> # 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 */ #elif defined( HAVE_CTHREADS_H ) /* GNUMach */
# include <cthreads.h> # include <cthreads.h>
...@@ -267,6 +269,18 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex ) ...@@ -267,6 +269,18 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex )
return pth_mutex_init( p_mutex ); return pth_mutex_init( p_mutex );
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) #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 ); return pthread_mutex_init( p_mutex, NULL );
#elif defined( HAVE_CTHREADS_H ) #elif defined( HAVE_CTHREADS_H )
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* and spawn threads. * and spawn threads.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * 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> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -289,8 +289,15 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) ...@@ -289,8 +289,15 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
*/ */
#if defined( SYS_BEOS ) || defined( SYS_DARWIN ) #if defined( SYS_BEOS ) || defined( SYS_DARWIN )
system_Init( &i_argc, ppsz_argv, ppsz_env ); system_Init( &i_argc, ppsz_argv, ppsz_env );
#elif defined( WIN32 ) #elif defined( WIN32 )
_fmode = _O_BINARY; /* sets the default file-translation mode on 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 #endif
/* /*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment