[asterisk-commits] mmichelson: trunk r92876 - in /trunk: ./ include/asterisk/lock.h

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Dec 13 19:25:36 CST 2007


Author: mmichelson
Date: Thu Dec 13 19:25:36 2007
New Revision: 92876

URL: http://svn.digium.com/view/asterisk?view=rev&rev=92876
Log:
Merged revisions 92875 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r92875 | mmichelson | 2007-12-13 19:24:06 -0600 (Thu, 13 Dec 2007) | 7 lines

When compiling with DETECT_DEADLOCKS, don't spam the CLI with messages
about possible deadlocks. Instead just print the intended single message every
five seconds.

(closes issue 11537, reported and patched by dimas)


........

Modified:
    trunk/   (props changed)
    trunk/include/asterisk/lock.h

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/include/asterisk/lock.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/lock.h?view=diff&rev=92876&r1=92875&r2=92876
==============================================================================
--- trunk/include/asterisk/lock.h (original)
+++ trunk/include/asterisk/lock.h Thu Dec 13 19:25:36 2007
@@ -329,7 +329,7 @@
 #ifdef DETECT_DEADLOCKS
 	{
 		time_t seconds = time(NULL);
-		time_t current;
+		time_t wait_time, reported_wait = 0;
 		do {
 #ifdef	HAVE_MTX_PROFILE
 			ast_mark(mtx_prof, 1);
@@ -339,15 +339,16 @@
 			ast_mark(mtx_prof, 0);
 #endif
 			if (res == EBUSY) {
-				current = time(NULL);
-				if ((current - seconds) && (!((current - seconds) % 5))) {
+				wait_time = time(NULL) - seconds;
+				if (wait_time > reported_wait && (wait_time % 5) == 0) {
 					__ast_mutex_logger("%s line %d (%s): Deadlock? waited %d sec for mutex '%s'?\n",
-							   filename, lineno, func, (int)(current - seconds), mutex_name);
+							   filename, lineno, func, (int) wait_time, mutex_name);
 					ast_reentrancy_lock(t);
 					__ast_mutex_logger("%s line %d (%s): '%s' was locked here.\n",
 							   t->file[t->reentrancy-1], t->lineno[t->reentrancy-1],
 							   t->func[t->reentrancy-1], mutex_name);
 					ast_reentrancy_unlock(t);
+					reported_wait = wait_time;
 				}
 				usleep(200);
 			}




More information about the asterisk-commits mailing list