clean up children more often
This commit is contained in:
parent
f9aa99c72e
commit
65de82a30f
1 changed files with 7 additions and 3 deletions
|
|
@ -25,8 +25,8 @@ _schedinit(void *arg)
|
||||||
{
|
{
|
||||||
Proc *p;
|
Proc *p;
|
||||||
Thread *t;
|
Thread *t;
|
||||||
extern void ignusr1(void), _threaddie(int);
|
extern void ignusr1(int), _threaddie(int);
|
||||||
ignusr1();
|
ignusr1(1);
|
||||||
signal(SIGTERM, _threaddie);
|
signal(SIGTERM, _threaddie);
|
||||||
|
|
||||||
p = arg;
|
p = arg;
|
||||||
|
|
@ -103,7 +103,8 @@ runthread(Proc *p)
|
||||||
q = &p->ready;
|
q = &p->ready;
|
||||||
relock:
|
relock:
|
||||||
lock(&p->readylock);
|
lock(&p->readylock);
|
||||||
if(q->head == nil){
|
if(p->nsched%128 == 0){
|
||||||
|
/* clean up children */
|
||||||
e = errno;
|
e = errno;
|
||||||
if((c = _threadwaitchan) != nil){
|
if((c = _threadwaitchan) != nil){
|
||||||
if(c->n <= c->s){
|
if(c->n <= c->s){
|
||||||
|
|
@ -131,6 +132,8 @@ relock:
|
||||||
free(w);
|
free(w);
|
||||||
}
|
}
|
||||||
errno = e;
|
errno = e;
|
||||||
|
}
|
||||||
|
if(q->head == nil){
|
||||||
if(p->idle){
|
if(p->idle){
|
||||||
if(p->idle->state != Ready){
|
if(p->idle->state != Ready){
|
||||||
fprint(2, "everyone is asleep\n");
|
fprint(2, "everyone is asleep\n");
|
||||||
|
|
@ -204,6 +207,7 @@ Resched:
|
||||||
t->state = Running;
|
t->state = Running;
|
||||||
t->nextstate = Ready;
|
t->nextstate = Ready;
|
||||||
_gotolabel(&t->sched);
|
_gotolabel(&t->sched);
|
||||||
|
for(;;);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue