summaryrefslogtreecommitdiff
path: root/kernel/proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/proc.c')
-rw-r--r--kernel/proc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/proc.c b/kernel/proc.c
index 54c965d..bd77dad 100644
--- a/kernel/proc.c
+++ b/kernel/proc.c
@@ -358,14 +358,14 @@ exit(int status)
p->cwd = 0;
acquire(&proc_tree_lock);
-
- acquire(&p->lock);
// Give any children to init.
reparent(p);
// Parent might be sleeping in wait().
wakeup(p->parent);
+
+ acquire(&p->lock);
p->xstate = status;
p->state = ZOMBIE;
@@ -393,7 +393,9 @@ wait(uint64 addr)
havekids = 0;
for(np = proc; np < &proc[NPROC]; np++){
if(np->parent == p){
+ // make sure the child isn't still in exit() or swtch().
acquire(&np->lock);
+
havekids = 1;
if(np->state == ZOMBIE){
// Found one.