[asterisk-commits] russell: branch russell/smdi-1.4 r92822 - /team/russell/smdi-1.4/res/res_smdi.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Dec 13 15:50:28 CST 2007


Author: russell
Date: Thu Dec 13 15:50:27 2007
New Revision: 92822

URL: http://svn.digium.com/view/asterisk?view=rev&rev=92822
Log:
Adjust handling of the polling interval such that it polls every polling interval,
and not just after that much time has past since the end of the last operation.

Modified:
    team/russell/smdi-1.4/res/res_smdi.c

Modified: team/russell/smdi-1.4/res/res_smdi.c
URL: http://svn.digium.com/view/asterisk/team/russell/smdi-1.4/res/res_smdi.c?view=diff&rev=92822&r1=92821&r2=92822
==============================================================================
--- team/russell/smdi-1.4/res/res_smdi.c (original)
+++ team/russell/smdi-1.4/res/res_smdi.c Thu Dec 13 15:50:27 2007
@@ -91,6 +91,8 @@
 	unsigned int polling_interval;
 	/*! Set to 1 to tell the polling thread to stop */
 	unsigned int stop:1;
+	/*! The time that the last poll began */
+	struct timeval last_poll;
 } mwi_monitor = {
 	.thread = AST_PTHREADT_NULL,
 };
@@ -614,12 +616,14 @@
 
 		ast_mutex_lock(&mwi_monitor.lock);
 
+		mwi_monitor.last_poll = ast_tvnow();
+
 		AST_LIST_TRAVERSE(&mwi_monitor.mailbox_mappings, mm, entry)
 			poll_mailbox(mm);
 
 		/* Sleep up to the configured polling interval.  Allow unload_module()
 		 * to signal us to wake up and exit. */
-		tv = ast_tvadd(ast_tvnow(), ast_tv(mwi_monitor.polling_interval, 0));
+		tv = ast_tvadd(mwi_monitor.last_poll, ast_tv(mwi_monitor.polling_interval, 0));
 		ts.tv_sec = tv.tv_sec;
 		ts.tv_nsec = tv.tv_usec * 1000;
 		ast_cond_timedwait(&mwi_monitor.cond, &mwi_monitor.lock, &ts);




More information about the asterisk-commits mailing list