shithub: riscv

Download patch

ref: 6e1c833585a78e534a0b4a7c990faba7d4dcdd45
parent: f6887b0a3c0a18c59721ea5a006a1c31b3604591
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:
--