]> git.lizzy.rs Git - plan9front.git/commitdiff
libthread: avoid calling thread waiting for fork/execed process to finish if we dont...
authorcinap_lenrek <cinap_lenrek@felloff.net>
Fri, 6 Dec 2013 04:03:35 +0000 (05:03 +0100)
committercinap_lenrek <cinap_lenrek@felloff.net>
Fri, 6 Dec 2013 04:03:35 +0000 (05:03 +0100)
we do not need to wait for fork/execed program to finish when
not collecting waitmsg. this reduces the number of rio
processes hanging arround for each window shell just waiting
for it to terminate and then dumping the waitmsg.

sys/src/libthread/main.c

index 1dcd9c3190da2f9952db53adc4c50f2c08c01947..03c069c1442cdde1575f0f45e0f3e0e7b50fdd1d 100644 (file)
@@ -121,9 +121,10 @@ efork(Execargs *e)
 int
 _schedexec(Execargs *e)
 {
-       int pid;
+       int pid, flag;
 
-       switch(pid = rfork(RFREND|RFNOTEG|RFFDG|RFMEM|RFPROC)){
+       flag = (_threadwaitchan == nil) ? RFNOWAIT : 0;
+       switch(pid = rfork(RFREND|RFNOTEG|RFFDG|RFMEM|RFPROC|flag)){
        case 0:
                efork(e);
        default: