diff options
author | rsc <devnull@localhost> | 2004-06-09 14:23:34 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-06-09 14:23:34 +0000 |
commit | 65de82a30f67103eb9ec1cbc9ab62725b03e7423 (patch) | |
tree | 0c514bcc4ff1cdc626288081c82e74f665868d68 | |
parent | f9aa99c72e86fa546a504d34ade4b3ca3164d9da (diff) | |
download | plan9port-65de82a30f67103eb9ec1cbc9ab62725b03e7423.tar.gz plan9port-65de82a30f67103eb9ec1cbc9ab62725b03e7423.tar.bz2 plan9port-65de82a30f67103eb9ec1cbc9ab62725b03e7423.zip |
clean up children more often
-rw-r--r-- | src/libthread/sched.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libthread/sched.c b/src/libthread/sched.c index bdb9ad6b..cfc76d67 100644 --- a/src/libthread/sched.c +++ b/src/libthread/sched.c @@ -25,8 +25,8 @@ _schedinit(void *arg) { Proc *p; Thread *t; - extern void ignusr1(void), _threaddie(int); - ignusr1(); + extern void ignusr1(int), _threaddie(int); + ignusr1(1); signal(SIGTERM, _threaddie); p = arg; @@ -103,7 +103,8 @@ runthread(Proc *p) q = &p->ready; relock: lock(&p->readylock); - if(q->head == nil){ + if(p->nsched%128 == 0){ + /* clean up children */ e = errno; if((c = _threadwaitchan) != nil){ if(c->n <= c->s){ @@ -131,6 +132,8 @@ relock: free(w); } errno = e; + } + if(q->head == nil){ if(p->idle){ if(p->idle->state != Ready){ fprint(2, "everyone is asleep\n"); @@ -204,6 +207,7 @@ Resched: t->state = Running; t->nextstate = Ready; _gotolabel(&t->sched); + for(;;); } } |