From 68e92f2ba977bbf5972ee3389ed379fe6e206ce4 Mon Sep 17 00:00:00 2001 From: jilles Date: Sat, 28 Jul 2012 15:13:48 +0000 Subject: sh: Do not ask for stopped/continued processes if we do not need them rather than retrying wait3 if they happen. --- bin/sh/jobs.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'bin') diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c index feb9e1f..a8ed079 100644 --- a/bin/sh/jobs.c +++ b/bin/sh/jobs.c @@ -1025,17 +1025,16 @@ dowait(int block, struct job *job) TRACE(("dowait(%d) called\n", block)); do { #if JOBS - wflags = WUNTRACED | WCONTINUED; -#else - wflags = 0; + if (iflag) + wflags = WUNTRACED | WCONTINUED; + else #endif + wflags = 0; if (block == 0) wflags |= WNOHANG; pid = wait3(&status, wflags, (struct rusage *)NULL); TRACE(("wait returns %d, status=%d\n", (int)pid, status)); - } while ((pid == -1 && errno == EINTR && breakwaitcmd == 0) || - (pid > 0 && (WIFSTOPPED(status) || WIFCONTINUED(status)) && - !iflag)); + } while (pid == -1 && errno == EINTR && breakwaitcmd == 0); if (pid == -1 && errno == ECHILD && job != NULL) job->state = JOBDONE; if (breakwaitcmd != 0) { -- cgit v1.1