Index: Makefile =================================================================== RCS file: /usr/cvsroot/asterisk/Makefile,v retrieving revision 1.114.2.3 diff -u -r1.114.2.3 Makefile --- Makefile 21 Jan 2005 05:18:35 -0000 1.114.2.3 +++ Makefile 8 Feb 2005 13:13:20 -0000 @@ -77,7 +77,7 @@ #OPTIONS += -DLOW_MEMORY # Optional debugging parameters -DEBUG_THREADS = #-DDEBUG_THREADS #-DDO_CRASH +DEBUG_THREADS = #-DDEBUG_THREADS #-DDO_CRASH #-DDETECT_DEADLOCKS # Uncomment next one to enable ast_frame tracing (for debugging) TRACE_FRAMES = #-DTRACE_FRAMES Index: include/asterisk/lock.h =================================================================== RCS file: /usr/cvsroot/asterisk/include/asterisk/lock.h,v retrieving revision 1.23 diff -u -r1.23 lock.h --- include/asterisk/lock.h 8 Aug 2004 17:15:02 -0000 1.23 +++ include/asterisk/lock.h 8 Feb 2005 13:13:21 -0000 @@ -188,17 +188,19 @@ filename, lineno, func, mutex_name); #endif ast_mutex_init(t); - } + } #endif /* definded(AST_MUTEX_INIT_W_CONSTRUCTORS) || defined(AST_MUTEX_INIT_ON_FIRST_USE) */ #ifdef DETECT_DEADLOCKS { - time_t seconds seconds = time(NULL); + time_t seconds = time(NULL); + time_t current; do { res = pthread_mutex_trylock(&t->mutex); if (res == EBUSY) { - if ((time(NULL) - seconds) % 5) { + current = time(NULL); + if ((current - seconds) && (!((current - seconds) % 5))) { fprintf(stderr, "%s line %d (%s): Deadlock? waited %d sec for mutex '%s'?\n", - filename, lineno, func, (time(NULL) - seconds), mutex_name); + filename, lineno, func, (int)(current - seconds), mutex_name); fprintf(stderr, "%s line %d (%s): '%s' was locked here.\n", t->file, t->lineno, t->func, mutex_name); }