[OPTIM] shrink wake_expired_tasks() by using task_wakeup()

It's not worth duplicating task_wakeup() in wake_expired_tasks().
Calling it reduces code size and slightly improves performance.
This commit is contained in:
Willy Tarreau 2008-06-29 19:25:52 +02:00
parent 69e989ccbc
commit af754fc88f

View File

@ -179,8 +179,6 @@ void wake_expired_tasks(struct timeval *next)
do { do {
eb = eb32_first(&timers[tree]); eb = eb32_first(&timers[tree]);
while (eb) { while (eb) {
struct eb32_node *next_eb;
task = eb32_entry(eb, struct task, eb); task = eb32_entry(eb, struct task, eb);
if ((now_ms - eb->key) & TIMER_SIGN_BIT) { if ((now_ms - eb->key) & TIMER_SIGN_BIT) {
/* note that we don't need this check for the <previous> /* note that we don't need this check for the <previous>
@ -190,14 +188,9 @@ void wake_expired_tasks(struct timeval *next)
return; return;
} }
/* detach the task from the queue */ /* detach the task from the queue and add the task to the run queue */
next_eb = eb32_next(eb); eb = eb32_next(eb);
eb32_delete(eb); _task_wakeup(task);
eb = next_eb;
/* and add the task to the run queue */
DLIST_ADD(run_queue, &task->qlist);
task->state = TASK_RUNNING;
} }
tree = (tree + 1) & TIMER_TREE_MASK; tree = (tree + 1) & TIMER_TREE_MASK;
} while (((tree - now_tree) & TIMER_TREE_MASK) < TIMER_TREES/2); } while (((tree - now_tree) & TIMER_TREE_MASK) < TIMER_TREES/2);