aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2013-05-03 10:48:22 +0100
committerRon Yorston <rmy@pobox.com>2013-05-03 10:48:22 +0100
commit88b8cb61e8fb1db9026518c2302331b30146b9f2 (patch)
tree49ff75b7c613b4f4940add119b0f70022c3fafa0 /shell
parent6f2592dab9edd712dde7627aa2aca98e4ae1de04 (diff)
downloadbusybox-w32-88b8cb61e8fb1db9026518c2302331b30146b9f2.tar.gz
busybox-w32-88b8cb61e8fb1db9026518c2302331b30146b9f2.tar.bz2
busybox-w32-88b8cb61e8fb1db9026518c2302331b30146b9f2.zip
ash: Add a very small timeout to nonblocking wait
A nonblocking waitpid was implemented using WaitForMultipleObjects with a timeout of 0. This was to fix an issue where builtin commands in a foreground shell were blocked while a background command was running. However, this caused the shell to consume 100% CPU. A workaround seems to be to use a very small (1ms) timeout.
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c
index e7a0e5dc5..80a85b9eb 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -4153,7 +4153,7 @@ waitpid_child(int *status, int wait_flags)
4153 #undef LOOP 4153 #undef LOOP
4154 4154
4155 idx = WaitForMultipleObjects(pid_nr, pidlist, FALSE, 4155 idx = WaitForMultipleObjects(pid_nr, pidlist, FALSE,
4156 wait_flags|WNOHANG ? 0 : INFINITE); 4156 wait_flags|WNOHANG ? 1 : INFINITE);
4157 if (idx >= pid_nr) { 4157 if (idx >= pid_nr) {
4158 free(pidlist); 4158 free(pidlist);
4159 return -1; 4159 return -1;