diff options
author | jardin <jardin> | 2003-12-23 08:56:18 +0000 |
---|---|---|
committer | jardin <jardin> | 2003-12-23 08:56:18 +0000 |
commit | 9e867fe663c4eb43c36f35067c0dd092e8c83c14 (patch) | |
tree | f29461b6a2dc8c38037dc0cf91e70392f9ed4ab2 /lib/thread.c | |
parent | eb5d44eb8dcf25a1b328e57d1eabb1f89e3bc59b (diff) | |
download | quagga-9e867fe663c4eb43c36f35067c0dd092e8c83c14.tar.bz2 quagga-9e867fe663c4eb43c36f35067c0dd092e8c83c14.tar.xz |
Merge isisd into the Quagga's framework:
- add privs support
- use misc quagga's definitions
- make it compile"able"
- fix segfault cases related to hostname()
- add debug isis xxx command
This patch has been approved by Paul Jakma.
Diffstat (limited to 'lib/thread.c')
-rw-r--r-- | lib/thread.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/thread.c b/lib/thread.c index 402167cf..93809f2f 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -518,6 +518,46 @@ funcname_thread_add_timer (struct thread_master *m, return thread; } +/* Add timer event thread with "millisecond" resolution */ +struct thread * +funcname_thread_add_timer_msec (struct thread_master *m, + int (*func) (struct thread *), void *arg, long timer, char* funcname) +{ + struct timeval timer_now; + struct thread *thread; +#ifndef TIMER_NO_SORT + struct thread *tt; +#endif /* TIMER_NO_SORT */ + + assert (m != NULL); + + thread = thread_get (m, THREAD_TIMER, func, arg, funcname); + + timer = 1000*timer; /* milli -> micro */ + + /* Do we need jitter here? */ + gettimeofday (&timer_now, NULL); + timer_now.tv_sec += timer / TIMER_SECOND_MICRO; + timer_now.tv_usec += (timer % TIMER_SECOND_MICRO); + thread->u.sands = timer_now; + + /* Sort by timeval. */ +#ifdef TIMER_NO_SORT + thread_list_add (&m->timer, thread); +#else + for (tt = m->timer.head; tt; tt = tt->next) + if (timeval_cmp (thread->u.sands, tt->u.sands) <= 0) + break; + + if (tt) + thread_list_add_before (&m->timer, tt, thread); + else + thread_list_add (&m->timer, thread); +#endif /* TIMER_NO_SORT */ + + return thread; +} + /* Add simple event thread. */ struct thread * funcname_thread_add_event (struct thread_master *m, |