[asterisk-commits] russell: branch 1.6.1 r175890 - in /branches/1.6.1: ./ include/asterisk/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Feb 15 15:28:55 CST 2009


Author: russell
Date: Sun Feb 15 15:28:55 2009
New Revision: 175890

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=175890
Log:
Merged revisions 175882 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r175882 | russell | 2009-02-15 15:27:33 -0600 (Sun, 15 Feb 2009) | 2 lines

Make ast_sched_report() and ast_sched_dump() thread safe.

........

Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/include/asterisk/sched.h
    branches/1.6.1/main/sched.c

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.1/include/asterisk/sched.h
URL: http://svn.digium.com/svn-view/asterisk/branches/1.6.1/include/asterisk/sched.h?view=diff&rev=175890&r1=175889&r2=175890
==============================================================================
--- branches/1.6.1/include/asterisk/sched.h (original)
+++ branches/1.6.1/include/asterisk/sched.h Sun Feb 15 15:28:55 2009
@@ -255,7 +255,7 @@
  * Debugging: Dump the contents of the scheduler to stderr
  * \param con Context to dump
  */
-void ast_sched_dump(const struct sched_context *con);
+void ast_sched_dump(struct sched_context *con);
 
 /*! \brief Returns the number of seconds before an event takes place
  * \param con Context to use

Modified: branches/1.6.1/main/sched.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.6.1/main/sched.c?view=diff&rev=175890&r1=175889&r2=175890
==============================================================================
--- branches/1.6.1/main/sched.c (original)
+++ branches/1.6.1/main/sched.c Sun Feb 15 15:28:55 2009
@@ -394,6 +394,7 @@
 	
 	ast_str_set(buf, 0, " Highwater = %d\n schedcnt = %d\n", con->highwater, con->schedcnt);
 
+	ast_mutex_lock(&con->lock);
 	AST_DLLIST_TRAVERSE(&con->schedq, cur, list) {
 		/* match the callback to the cblist */
 		for (i = 0; i < cbnames->numassocs; i++) {
@@ -407,6 +408,7 @@
 			countlist[cbnames->numassocs]++;
 		}
 	}
+	ast_mutex_unlock(&con->lock);
 
 	for (i = 0; i < cbnames->numassocs; i++) {
 		ast_str_append(buf, 0, "    %s : %d\n", cbnames->list[i], countlist[i]);
@@ -416,7 +418,7 @@
 }
 	
 /*! \brief Dump the contents of the scheduler to LOG_DEBUG */
-void ast_sched_dump(const struct sched_context *con)
+void ast_sched_dump(struct sched_context *con)
 {
 	struct sched *q;
 	struct timeval when = ast_tvnow();
@@ -429,6 +431,7 @@
 	ast_debug(1, "=============================================================\n");
 	ast_debug(1, "|ID    Callback          Data              Time  (sec:ms)   |\n");
 	ast_debug(1, "+-----+-----------------+-----------------+-----------------+\n");
+	ast_mutex_lock(&con->lock);
 	AST_DLLIST_TRAVERSE(&con->schedq, q, list) {
 		struct timeval delta = ast_tvsub(q->when, when);
 
@@ -439,8 +442,8 @@
 			(long)delta.tv_sec,
 			(long int)delta.tv_usec);
 	}
+	ast_mutex_unlock(&con->lock);
 	ast_debug(1, "=============================================================\n");
-	
 }
 
 /*! \brief




More information about the asterisk-commits mailing list