[asterisk-commits] tilghman: branch tilghman/sched-fu r137899 - /team/tilghman/sched-fu/main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Aug 14 12:44:00 CDT 2008
Author: tilghman
Date: Thu Aug 14 12:43:59 2008
New Revision: 137899
URL: http://svn.digium.com/view/asterisk?view=rev&rev=137899
Log:
More optimizations
Modified:
team/tilghman/sched-fu/main/sched.c
Modified: team/tilghman/sched-fu/main/sched.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/sched-fu/main/sched.c?view=diff&rev=137899&r1=137898&r2=137899
==============================================================================
--- team/tilghman/sched-fu/main/sched.c (original)
+++ team/tilghman/sched-fu/main/sched.c Thu Aug 14 12:43:59 2008
@@ -72,6 +72,7 @@
};
#define CALC_SLOT(a) (((a).tv_sec % 60) * 10 + ((a).tv_usec / 100000))
+#define NEXT_SLOT(a) ((a) == 599 ? 0 : (a) + 1)
/* hash routines for sched */
@@ -196,7 +197,7 @@
DEBUG(ast_debug(1, "ast_sched_wait()\n"));
if (con->last_executed > -1) {
- start = (con->last_executed == 599) ? 0 : con->last_executed + 1;
+ start = con->last_executed;
end = CALC_SLOT(now);
if (start == end) {
/* Search all */
@@ -477,8 +478,12 @@
DEBUG(ast_debug(1, "ast_sched_runq()\n"));
if (con->last_executed > -1) {
- start = con->last_executed + 1;
- end = CALC_SLOT(now);
+ start = con->last_executed;
+ end = NEXT_SLOT(CALC_SLOT(now));
+ if (start == end) {
+ start = 0;
+ end = 600;
+ }
}
for (i = start; i != end; i = (i == 599 && end != 600) ? 0 : i + 1) {
@@ -528,11 +533,12 @@
}
}
/* Move the endposts, but don't end prematurely */
- if (CALC_SLOT(now) != end) {
- end = CALC_SLOT(now);
+ if (NEXT_SLOT(CALC_SLOT(now)) != end && end != 600) {
+ end = NEXT_SLOT(CALC_SLOT(now));
}
usleep(1);
}
+ con->last_executed = end == 0 ? 599 : end - 1;
return numevents;
}
More information about the asterisk-commits
mailing list