git: 9front

Download patch

ref: d9ef889d28d434aa5d1facbcc354964780352cf1
parent: c0f42102fe860e0a85d00177714b81098a87ded1
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Dec 6 00:03:35 EST 2013

libthread: avoid calling thread waiting for fork/execed process to finish if we dont have to

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.

--- a/sys/src/libthread/main.c
+++ b/sys/src/libthread/main.c
@@ -121,9 +121,10 @@
 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:
--