don't over-lock in exit()
This commit is contained in:
parent
47323c97cf
commit
ba8d9f4808
2 changed files with 7 additions and 3 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue