[PATCH] remove busy-wait loop in cmdline.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

While using crash I found that it would suck all my CPU when external commands are invoked (eg. bt piped to $PAGER). The patch below works for me.


Cheers,

--
saffroy@xxxxxxxxx

Index: crash-4.0-3.4/cmdline.c
===================================================================
--- crash-4.0-3.4.orig/cmdline.c	2006-09-25 00:28:11.000000000 +0200
+++ crash-4.0-3.4/cmdline.c	2006-09-25 00:30:30.000000000 +0200
@@ -846,10 +846,8 @@
         if (pc->stdpipe) {
 		close(fileno(pc->stdpipe));
                 pc->stdpipe = NULL;
-		if (pc->stdpipe_pid && PID_ALIVE(pc->stdpipe_pid)) {
-			while (!waitpid(pc->stdpipe_pid, &waitstatus, WNOHANG))
-				;
-		}
+		if (pc->stdpipe_pid && PID_ALIVE(pc->stdpipe_pid))
+			waitpid(pc->stdpipe_pid, &waitstatus, 0);
 		pc->stdpipe_pid = 0;
         }
 	if (pc->pipe) {

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux