callout_schedule uses ticks as timeunit, not usecs.
As suggested by Rene Gollent, we used ticks as usecs.
This commit is contained in:
parent
4feeeb4a8f
commit
a2e7d8df7b
@ -172,7 +172,7 @@ callout_init_mtx(struct callout *c, struct mtx *mtx, int flags)
|
|||||||
|
|
||||||
|
|
||||||
int
|
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);
|
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);
|
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
|
// reschedule or add this timer
|
||||||
if (c->due <= 0)
|
if (c->due <= 0)
|
||||||
list_add_item(&sTimers, c);
|
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
|
// notify timer about the change if necessary
|
||||||
if (sTimeout > c->due)
|
if (sTimeout > c->due)
|
||||||
@ -200,9 +200,9 @@ callout_reset(struct callout *c, int when, void (*func)(void *), void *arg)
|
|||||||
|
|
||||||
|
|
||||||
int
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,8 +30,9 @@ struct callout {
|
|||||||
|
|
||||||
void callout_init(struct callout *c, int mpsafe);
|
void callout_init(struct callout *c, int mpsafe);
|
||||||
void callout_init_mtx(struct callout *c, struct mtx *mutex, int flags);
|
void callout_init_mtx(struct callout *c, struct mtx *mutex, int flags);
|
||||||
int callout_schedule(struct callout *c, int when);
|
/* Time values are in ticks, see compat/sys/kernel.h for its definition */
|
||||||
int callout_reset(struct callout *c, int when, void (*func)(void *), void *arg);
|
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_pending(struct callout *c);
|
||||||
int callout_active(struct callout *c);
|
int callout_active(struct callout *c);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user