Submit #1699 » 0001-callout-9-introduce-callout_reset_-m-s-similarly-to-.patch
sys/kern/kern_timeout.c | ||
---|---|---|
#include <sys/thread2.h>
|
||
#include <sys/mplock2.h>
|
||
#include <machine/limits.h>
|
||
#ifndef MAX_SOFTCLOCK_STEPS
|
||
#define MAX_SOFTCLOCK_STEPS 100 /* Maximum allowed value of steps. */
|
||
#endif
|
||
... | ... | |
crit_exit_gd(gd);
|
||
}
|
||
void
|
||
callout_reset_s(struct callout *c, int s, void (*ftn)(void *),
|
||
void *arg)
|
||
{
|
||
uintmax_t t;
|
||
t = (uintmax_t)s * hz;
|
||
if (t > INT_MAX)
|
||
t = INT_MAX;
|
||
callout_reset(c, t, ftn, arg);
|
||
}
|
||
void
|
||
callout_reset_ms(struct callout *c, int ms, void (*ftn)(void *),
|
||
void *arg)
|
||
{
|
||
uintmax_t t;
|
||
t = (uintmax_t)ms * hz / 1000;
|
||
if (t > INT_MAX)
|
||
t = INT_MAX;
|
||
callout_reset(c, t, ftn, arg);
|
||
}
|
||
/*
|
||
* Stop a running timer. WARNING! If called on a cpu other then the one
|
||
* the callout was started on this function will liveloop on its IPI to
|
sys/sys/callout.h | ||
---|---|---|
void callout_init (struct callout *);
|
||
void callout_init_mp (struct callout *);
|
||
void callout_reset (struct callout *, int, void (*)(void *), void *);
|
||
void callout_reset_s (struct callout *, int, void (*)(void *), void *);
|
||
void callout_reset_ms (struct callout *, int, void (*)(void *), void *);
|
||
int callout_stop (struct callout *);
|
||
#endif
|