summaryrefslogtreecommitdiffstats
path: root/lib/thread.c
diff options
context:
space:
mode:
authorpaulo <paul@bayleaf.org.uk>2010-01-18 18:29:24 +0000
committerpaulo <paul@bayleaf.org.uk>2010-01-18 18:29:24 +0000
commite0f9836737c9e91b8fa4c72b45d1fdc286e2d811 (patch)
treea381719277e9b5707342ba244ede49b84709d630 /lib/thread.c
parentc93d1e18aa83080214de264ea7b7cbe517ecb1db (diff)
downloadquagga-e0f9836737c9e91b8fa4c72b45d1fdc286e2d811.tar.bz2
quagga-e0f9836737c9e91b8fa4c72b45d1fdc286e2d811.tar.xz
Merged with GMCH changes
Diffstat (limited to 'lib/thread.c')
-rw-r--r--lib/thread.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/lib/thread.c b/lib/thread.c
index 62f9669f..09a082cf 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -1052,22 +1052,6 @@ thread_fetch_event (struct thread_master *m, struct thread *fetch,
if ((thread = thread_trim_head (&m->ready)) != NULL)
return thread_run (m, thread, fetch);
- /* Calculate select wait timer if nothing else to do */
- quagga_get_relative (NULL);
- timer_wait = thread_timer_wait (&m->timer, &timer_val);
- timer_wait_bg = thread_timer_wait (&m->background, &timer_val_bg);
-
- if (timer_wait_bg &&
- (!timer_wait || (timeval_cmp (*timer_wait, *timer_wait_bg) > 0)))
- timer_wait = timer_wait_bg;
-
- /* When is the next timer due ? */
- if (timer_wait)
- {
- *event_wait = timeval2qtime(timer_wait);
- return NULL;
- }
-
/* Check foreground timers. Historically, they have had higher
priority than I/O threads, so let's push them onto the ready
list in front of the I/O threads. */
@@ -1080,6 +1064,19 @@ thread_fetch_event (struct thread_master *m, struct thread *fetch,
if ((thread = thread_trim_head (&m->ready)) != NULL)
return thread_run (m, thread, fetch);
+ /* Calculate select wait timer if nothing else to do */
+ timer_wait = thread_timer_wait (&m->timer, &timer_val);
+ timer_wait_bg = thread_timer_wait (&m->background, &timer_val_bg);
+
+ if (timer_wait_bg &&
+ (!timer_wait || (timeval_cmp (*timer_wait, *timer_wait_bg) > 0)))
+ timer_wait = timer_wait_bg;
+
+ /* When is the next timer due ? */
+ *event_wait = (timer_wait != NULL)
+ ? timeval2qtime(timer_wait)
+ : 0;
+
return NULL;
}