1
mirror of https://code.videolan.org/videolan/vlc synced 2024-09-04 09:11:33 +02:00

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

This commit is contained in:
Christophe Massiot 2001-10-01 12:48:01 +00:00
parent d8797a4827
commit e6a8d661ed
3 changed files with 24 additions and 3 deletions

View File

@ -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

View 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 )

View 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
/*