summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2008-10-30 17:09:14 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2008-10-30 17:09:14 +0000
commitdfe3458a7e86815a01f387bbe3381afd99ed87d2 (patch)
tree8b164e4914a673173227b2702f1dab19503f9c8f
parent99b87a40d0343dabec1b05984030c74834c3744b (diff)
Use msleep() in the reaper to make it not lose events. Based on discussion
PR 5609, and revisited with dlg. Tested on all platforms. ok miod
-rw-r--r--sys/kern/kern_exit.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index ee45596f495..d3396e2e8dc 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exit.c,v 1.76 2008/10/14 18:27:29 guenther Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.77 2008/10/30 17:09:13 deraadt Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
@@ -388,17 +388,13 @@ reaper(void)
for (;;) {
mtx_enter(&deadproc_mutex);
- p = LIST_FIRST(&deadproc);
- if (p == NULL) {
- /* No work for us; go to sleep until someone exits. */
- mtx_leave(&deadproc_mutex);
- (void) tsleep(&deadproc, PVM, "reaper", 0);
- continue;
- }
+ while ((p = LIST_FIRST(&deadproc)) == NULL)
+ msleep(&deadproc, &deadproc_mutex, PVM, "reaper", 0);
/* Remove us from the deadproc list. */
LIST_REMOVE(p, p_hash);
mtx_leave(&deadproc_mutex);
+
KERNEL_PROC_LOCK(curproc);
/*