提交 b525711e authored 作者: Anthony Minessale's avatar Anthony Minessale

do less work in timer thread to meet silly new kernels half way

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7907 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 bcdacc6f
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#endif #endif
#define MAX_TICK UINT32_MAX - 1024 #define MAX_TICK UINT32_MAX - 1024
#define MS_PER_TICK 10
static switch_memory_pool_t *module_pool = NULL; static switch_memory_pool_t *module_pool = NULL;
static struct { static struct {
...@@ -364,25 +364,19 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) ...@@ -364,25 +364,19 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
tick = 0; tick = 0;
} }
if ((current_ms % MS_PER_TICK) == 0) {
for (x = 0; x <= MAX_ELEMENTS; x++) { for (x = MS_PER_TICK; x <= MAX_ELEMENTS; x += MS_PER_TICK) {
int i = x, index; if ((current_ms % x) == 0) {
if (TIMER_MATRIX[x].count) {
if (i == 0) { TIMER_MATRIX[x].tick++;
i = 1; if (TIMER_MATRIX[x].tick == MAX_TICK) {
} TIMER_MATRIX[x].tick = 0;
TIMER_MATRIX[x].roll++;
index = (current_ms % i == 0) ? i : 0; }
}
if (TIMER_MATRIX[index].count) {
TIMER_MATRIX[index].tick++;
if (TIMER_MATRIX[x].tick == MAX_TICK) {
TIMER_MATRIX[x].tick = 0;
TIMER_MATRIX[x].roll++;
} }
} }
} }
if (current_ms == MAX_ELEMENTS) { if (current_ms == MAX_ELEMENTS) {
current_ms = 0; current_ms = 0;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论