From a2e7d8df7bf39721a597b0473831f25813d71b0e Mon Sep 17 00:00:00 2001 From: Fredrik Holmqvist Date: Wed, 18 Jul 2012 17:09:36 +0200 Subject: [PATCH] callout_schedule uses ticks as timeunit, not usecs. As suggested by Rene Gollent, we used ticks as usecs. --- src/libs/compat/freebsd_network/callout.cpp | 10 +++++----- src/libs/compat/freebsd_network/compat/sys/callout.h | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/libs/compat/freebsd_network/callout.cpp b/src/libs/compat/freebsd_network/callout.cpp index 1541580500..da06a5b310 100644 --- a/src/libs/compat/freebsd_network/callout.cpp +++ b/src/libs/compat/freebsd_network/callout.cpp @@ -172,7 +172,7 @@ callout_init_mtx(struct callout *c, struct mtx *mtx, int flags) int -callout_reset(struct callout *c, int when, void (*func)(void *), void *arg) +callout_reset(struct callout *c, int ticks, void (*func)(void *), void *arg) { int canceled = callout_stop(c); @@ -183,12 +183,12 @@ callout_reset(struct callout *c, int when, void (*func)(void *), void *arg) TRACE("callout_reset %p, func %p, arg %p\n", c, c->c_func, c->c_arg); - if (when >= 0) { + if (ticks >= 0) { // reschedule or add this timer if (c->due <= 0) list_add_item(&sTimers, c); - c->due = system_time() + when; + c->due = system_time() + ticks_to_usecs(ticks); // notify timer about the change if necessary if (sTimeout > c->due) @@ -200,9 +200,9 @@ callout_reset(struct callout *c, int when, void (*func)(void *), void *arg) int -callout_schedule(struct callout *callout, int toTicks) +callout_schedule(struct callout *callout, int ticks) { - return callout_reset(callout, toTicks, callout->c_func, callout->c_arg); + return callout_reset(callout, ticks, callout->c_func, callout->c_arg); } diff --git a/src/libs/compat/freebsd_network/compat/sys/callout.h b/src/libs/compat/freebsd_network/compat/sys/callout.h index 50909aa95f..9d4da3b944 100644 --- a/src/libs/compat/freebsd_network/compat/sys/callout.h +++ b/src/libs/compat/freebsd_network/compat/sys/callout.h @@ -30,8 +30,9 @@ struct callout { void callout_init(struct callout *c, int mpsafe); void callout_init_mtx(struct callout *c, struct mtx *mutex, int flags); -int callout_schedule(struct callout *c, int when); -int callout_reset(struct callout *c, int when, void (*func)(void *), void *arg); +/* Time values are in ticks, see compat/sys/kernel.h for its definition */ +int callout_schedule(struct callout *c, int ticks); +int callout_reset(struct callout *c, int ticks, void (*func)(void *), void *arg); int callout_pending(struct callout *c); int callout_active(struct callout *c);