sh: Do not ask for stopped/continued processes if we do not need them
rather than retrying wait3 if they happen.
This commit is contained in:
parent
61fb716ac9
commit
fb05913c5d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=238867
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user