summaryrefslogtreecommitdiffstats
path: root/lib/qtimers.c
diff options
context:
space:
mode:
authorChris Hall (GMCH) <chris.hall@highwayman.com>2009-12-09 17:59:03 +0000
committerChris Hall (GMCH) <chris.hall@highwayman.com>2009-12-09 17:59:03 +0000
commitb3edb8b2b5d1e9c7b23bad9de6802e89c3a8fd0b (patch)
tree8f71c2d4efb98e8644c881c3d055ebf29b6ddb4c /lib/qtimers.c
parent482674bb1e9401fa4f954fb03cdc84ad9908845f (diff)
downloadquagga-b3edb8b2b5d1e9c7b23bad9de6802e89c3a8fd0b.tar.bz2
quagga-b3edb8b2b5d1e9c7b23bad9de6802e89c3a8fd0b.tar.xz
Ensure all timeouts are timeout times in qtime_mono_t.
Introduced separate types for qtime_mono_t and qtime_real_t, to distinguish the time base of a given value. Revised all users of timeouts so that they are all expressed as qtime_mono_t values, so are all Quagga monotonic time based. Revised qpt_cond_timedwait() so that all condition variables use the same timebase (CLOCK_MONOTONIC if available, by default). Now all timeout times are qtime_mono_t, and are converted to whatever the condition variable is set to, if necessary. Added explicit timeout to mqueue. Fixed qps_pselect() to zeroise result vectors if no fds are reported pending -- seems the O/S does not do this.
Diffstat (limited to 'lib/qtimers.c')
-rw-r--r--lib/qtimers.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/qtimers.c b/lib/qtimers.c
index f4959983..d4aff6ec 100644
--- a/lib/qtimers.c
+++ b/lib/qtimers.c
@@ -1,4 +1,4 @@
-/* Quagga timers support -- header
+/* Quagga timers support -- functions
* Copyright (C) 2009 Chris Hall (GMCH), Highwayman
*
* This file is part of GNU Zebra.
@@ -52,9 +52,6 @@
*
* The time base for qtimers is the monotonic time provided in qtime.c/.h.
*
- * The qtimer_time_now(), qtimer_time_future(), timer_time_from_realtime(),
- * qtimer_time_from_timeofday() functions return qtimer times.
- *
* Action Functions
* ----------------
*
@@ -116,8 +113,8 @@ qtimer_pile_init_new(qtimer_pile qtp)
* empty, or the top entry times out after the maximum time, then the maximum
* is returned.
*/
-qtime_t
-qtimer_pile_top_time(qtimer_pile qtp, qtime_t max_time)
+qtime_mono_t
+qtimer_pile_top_time(qtimer_pile qtp, qtime_mono_t max_time)
{
qtimer qtr = heap_top_item(&qtp->timers) ;
@@ -138,7 +135,7 @@ qtimer_pile_top_time(qtimer_pile qtp, qtime_t max_time)
* false <=> nothing to do (and nothing done).
*/
int
-qtimer_pile_dispatch_next(qtimer_pile qtp, qtime_t upto)
+qtimer_pile_dispatch_next(qtimer_pile qtp, qtime_mono_t upto)
{
qtimer qtr ;
@@ -295,7 +292,7 @@ qtimer_set_info(qtimer qtr, void* timer_info)
* It is an error to set a timer which has a NULL action.
*/
void
-qtimer_set(qtimer qtr, qtime_t when, qtimer_action* action)
+qtimer_set(qtimer qtr, qtime_mono_t when, qtimer_action* action)
{
qtimer_pile qtp ;