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
This commit is contained in:
Anthony Minessale 2008-03-17 19:45:39 +00:00
parent bcdacc6fd3
commit b525711e44

View File

@ -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)
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;
} }