summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2000-11-25 03:34:49 +0000
committerjake <jake@FreeBSD.org>2000-11-25 03:34:49 +0000
commita177d57cb0bf5d68c28a8d74c9638eb4c906e656 (patch)
treeff3f9646036275aa9e0b94aa5eb96719db8d4681
parent87f2317296902dad6bb412e91d2fc95483ec305e (diff)
downloadFreeBSD-src-a177d57cb0bf5d68c28a8d74c9638eb4c906e656.zip
FreeBSD-src-a177d57cb0bf5d68c28a8d74c9638eb4c906e656.tar.gz
- Rename callout_reset to _callout_reset and add a flags argument.
- Add macros callout_reset, which does the obvious, and mp_callout_reset, which passes the CALLOUT_MPSAFE flag.
-rw-r--r--sys/kern/kern_timeout.c6
-rw-r--r--sys/sys/callout.h9
2 files changed, 12 insertions, 3 deletions
diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c
index 57be762..72b5302 100644
--- a/sys/kern/kern_timeout.c
+++ b/sys/kern/kern_timeout.c
@@ -242,11 +242,12 @@ callout_handle_init(struct callout_handle *handle)
* callout_deactivate() - marks the callout as having been serviced
*/
void
-callout_reset(c, to_ticks, ftn, arg)
+_callout_reset(c, to_ticks, ftn, arg, flags)
struct callout *c;
int to_ticks;
void (*ftn) __P((void *));
void *arg;
+ int flags;
{
int s;
@@ -264,7 +265,8 @@ callout_reset(c, to_ticks, ftn, arg)
to_ticks = 1;
c->c_arg = arg;
- c->c_flags |= (CALLOUT_ACTIVE | CALLOUT_PENDING);
+ c->c_flags |= (CALLOUT_ACTIVE | CALLOUT_PENDING |
+ (flags & CALLOUT_MPSAFE));
c->c_func = ftn;
c->c_time = ticks + to_ticks;
TAILQ_INSERT_TAIL(&callwheel[c->c_time & callwheelmask],
diff --git a/sys/sys/callout.h b/sys/sys/callout.h
index a90285f..a46055e 100644
--- a/sys/sys/callout.h
+++ b/sys/sys/callout.h
@@ -79,9 +79,16 @@ extern struct mtx callout_lock;
#define callout_deactivate(c) ((c)->c_flags &= ~CALLOUT_ACTIVE)
void callout_init __P((struct callout *));
#define callout_pending(c) ((c)->c_flags & CALLOUT_PENDING)
-void callout_reset __P((struct callout *, int, void (*)(void *), void *));
+void _callout_reset __P((struct callout *, int, void (*)(void *), void *,
+ int));
void callout_stop __P((struct callout *));
+#define callout_reset(c, ticks, func, arg) \
+ _callout_reset((c), (ticks), (func), (arg), 0)
+
+#define mp_callout_reset(c, ticks, func, arg) \
+ _callout_reset((c), (ticks), (func), (arg), CALLOUT_MPSAFE)
+
#endif
#endif /* _SYS_CALLOUT_H_ */
OpenPOWER on IntegriCloud