Remove useless signal-checking loop in job_continue

This loop has always been nonsense.
This commit is contained in:
ridiculousfish 2014-12-29 01:04:13 -08:00
parent 182faca2e5
commit e340baf6cc

View file

@ -83,11 +83,6 @@ Some of the code in this file is based on code from the Glibc manual.
*/ */
static int last_status=0; static int last_status=0;
/**
Signal flag
*/
static sig_atomic_t got_signal=0;
bool job_list_is_empty(void) bool job_list_is_empty(void)
{ {
ASSERT_IS_MAIN_THREAD(); ASSERT_IS_MAIN_THREAD();
@ -647,7 +642,6 @@ void job_handle_signal(int signal, siginfo_t *info, void *con)
{ {
/* This is the only place that this generation count is modified. It's OK if it overflows. */ /* This is the only place that this generation count is modified. It's OK if it overflows. */
s_sigchld_generation_count += 1; s_sigchld_generation_count += 1;
got_signal = 1;
} }
/* Given a command like "cat file", truncate it to a reasonable length */ /* Given a command like "cat file", truncate it to a reasonable length */
@ -1228,25 +1222,13 @@ void job_continue(job_t *j, bool cont)
if (job_get_flag(j, JOB_FOREGROUND)) if (job_get_flag(j, JOB_FOREGROUND))
{ {
int quit = 0; bool quit = false;
/* /*
Wait for job to report. Looks a bit ugly because it has to Wait for job to report.
handle the possibility that a signal is dispatched while
running job_is_stopped().
*/ */
while (!quit) while (! job_is_stopped(j) && ! job_is_completed(j))
{ {
do
{
got_signal = 0;
quit = job_is_stopped(j) || job_is_completed(j);
}
while (got_signal && !quit);
if (!quit)
{
// debug( 1, L"select_try()" ); // debug( 1, L"select_try()" );
switch (select_try(j)) switch (select_try(j))
{ {
@ -1292,8 +1274,6 @@ void job_continue(job_t *j, bool cont)
} }
break; break;
} }
}
} }
} }
} }