From b3edb8b2b5d1e9c7b23bad9de6802e89c3a8fd0b Mon Sep 17 00:00:00 2001 From: "Chris Hall (GMCH)" Date: Wed, 9 Dec 2009 17:59:03 +0000 Subject: 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. --- lib/qtimers.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'lib/qtimers.c') 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 ; -- cgit v1.2.3