[Asterisk-cvs] asterisk/include/asterisk lock.h,1.29,1.30

markster at lists.digium.com markster at lists.digium.com
Tue Feb 8 12:47:41 CST 2005


Update of /usr/cvsroot/asterisk/include/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv19537/include/asterisk

Modified Files:
	lock.h 
Log Message:
Minor deadlock detect fix (bug #3531)


Index: lock.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/lock.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- lock.h	21 Jan 2005 07:06:25 -0000	1.29
+++ lock.h	8 Feb 2005 18:48:01 -0000	1.30
@@ -194,17 +194,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);
 				}




More information about the svn-commits mailing list