aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2003-06-09 21:46:22 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2003-06-09 21:46:22 +0000
commit5499ea019d9028bc9389c3b091e1636ce1a623bc (patch)
treebc4a40f1f1c569953d5b333f2bacb41970eecb14 /sys/kern/kern_exit.c
parent8bccf7034ecb0e8289a7e8dbd3ac677c76b1c797 (diff)
downloadsrc-5499ea019d9028bc9389c3b091e1636ce1a623bc.tar.gz
src-5499ea019d9028bc9389c3b091e1636ce1a623bc.zip
Notes
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 2adfa9cf7b9b..e4550635f8d7 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -218,8 +218,18 @@ exit1(struct thread *td, int rv)
p->p_flag &= ~(P_TRACED | P_PPWAIT);
SIGEMPTYSET(p->p_siglist);
SIGEMPTYSET(td->td_siglist);
- if (timevalisset(&p->p_realtimer.it_value))
- callout_stop(&p->p_itcallout);
+
+ /*
+ * Stop the real interval timer. If the handler is currently
+ * executing, prevent it from rearming itself and let it finish.
+ */
+ if (timevalisset(&p->p_realtimer.it_value) &&
+ callout_stop(&p->p_itcallout) == 0) {
+ timevalclear(&p->p_realtimer.it_interval);
+ msleep(&p->p_itcallout, &p->p_mtx, PWAIT, "ritwait", 0);
+ KASSERT(!timevalisset(&p->p_realtimer.it_value),
+ ("realtime timer is still armed"));
+ }
PROC_UNLOCK(p);
/*