Use event_active, not 0-length timeouts. It's idempotent, too.

This commit is contained in:
Nick Mathewson 2013-10-14 13:17:11 -04:00 committed by Andrea Shepard
parent fc13184e44
commit 85ee5b3095

View File

@ -117,7 +117,6 @@ static smartlist_t *channels_pending = NULL;
*/ */
static struct event *run_sched_ev = NULL; static struct event *run_sched_ev = NULL;
static struct timeval run_sched_tv;
/* Scheduler static function declarations */ /* Scheduler static function declarations */
@ -300,13 +299,7 @@ static void
scheduler_retrigger(void) scheduler_retrigger(void)
{ {
tor_assert(run_sched_ev); tor_assert(run_sched_ev);
event_active(run_sched_ev, EV_TIMEOUT, 1);
if (!evtimer_pending(run_sched_ev, NULL)) {
log_debug(LD_SCHED, "Retriggering scheduler event");
event_del(run_sched_ev);
evtimer_add(run_sched_ev, &run_sched_tv);
}
} }
/** Notify the scheduler of a channel being closed */ /** Notify the scheduler of a channel being closed */
@ -362,10 +355,7 @@ scheduler_trigger(void)
tor_assert(run_sched_ev); tor_assert(run_sched_ev);
run_sched_tv.tv_sec = 0; event_add(run_sched_ev, EV_TIMEOUT, 1);
run_sched_tv.tv_usec = 0;
evtimer_add(run_sched_ev, &run_sched_tv);
} }
#endif #endif