summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>2001-03-15 16:47:51 +0000
committerConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>2001-03-15 16:47:51 +0000
commitda62a1ab881ab259e401bd5f4d66414b93b75c98 (patch)
treece47956949504d97de9851d7fde71332159cd2dd /sys
parentd0f7da8066530d27e468fad2306b316f799616fb (diff)
Triggered mechanism allows a handler to figure out whether a given
timeout is actually executing.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_timeout.c5
-rw-r--r--sys/sys/timeout.h5
2 files changed, 7 insertions, 3 deletions
diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c
index 7b992cfd32e..04e74fd62c2 100644
--- a/sys/kern/kern_timeout.c
+++ b/sys/kern/kern_timeout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_timeout.c,v 1.6 2001/02/16 13:47:40 espie Exp $ */
+/* $OpenBSD: kern_timeout.c,v 1.7 2001/03/15 16:47:50 csapuntz Exp $ */
/*
* Copyright (c) 2000 Artur Grabowski <art@openbsd.org>
* All rights reserved.
@@ -134,6 +134,7 @@ timeout_add(new, to_ticks)
new->to_flags |= TIMEOUT_ONQUEUE;
/* Initialize the time here, it won't change. */
new->to_time = to_ticks + ticks;
+ new->to_flags &= ~TIMEOUT_TRIGGERED;
/*
* Walk the list of pending timeouts and find an entry which
@@ -163,6 +164,7 @@ timeout_del(to)
TAILQ_REMOVE(&timeout_todo, to, to_list);
to->to_flags &= ~TIMEOUT_ONQUEUE;
}
+ to->to_flags &= ~TIMEOUT_TRIGGERED;
timeout_list_unlock(s);
}
@@ -199,6 +201,7 @@ softclock()
TAILQ_REMOVE(&timeout_todo, to, to_list);
to->to_flags &= ~TIMEOUT_ONQUEUE;
+ to->to_flags |= TIMEOUT_TRIGGERED;
fn = to->to_func;
arg = to->to_arg;
diff --git a/sys/sys/timeout.h b/sys/sys/timeout.h
index 3191d43a328..af52b93351b 100644
--- a/sys/sys/timeout.h
+++ b/sys/sys/timeout.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: timeout.h,v 1.6 2000/03/23 16:52:26 art Exp $ */
+/* $OpenBSD: timeout.h,v 1.7 2001/03/15 16:47:50 csapuntz Exp $ */
/*
* Copyright (c) 2000 Artur Grabowski <art@openbsd.org>
* All rights reserved.
@@ -74,7 +74,7 @@ struct timeout {
#define TIMEOUT_STATIC 1 /* allocated from static pool */
#define TIMEOUT_ONQUEUE 2 /* timeout is on the todo queue */
#define TIMEOUT_INITIALIZED 4 /* timeout is initialized */
-
+#define TIMEOUT_TRIGGERED 8 /* timeout is running or ran */
void timeout_set __P((struct timeout *, void (*)(void *), void *));
void timeout_add __P((struct timeout *, int));
void timeout_del __P((struct timeout *));
@@ -87,6 +87,7 @@ void timeout_del __P((struct timeout *));
*/
#define timeout_pending(to) ((to)->to_flags & TIMEOUT_ONQUEUE)
#define timeout_initialized(to) ((to)->to_flags & TIMEOUT_INITIALIZED)
+#define timeout_triggered(to) ((to)->to_flags & TIMEOUT_TRIGGERED)
/*
* timeout_init - called by the machine dependent code to initialize a static