mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 21:33:09 +00:00
Remove useless signal-checking loop in job_continue
This loop has always been nonsense.
This commit is contained in:
parent
182faca2e5
commit
e340baf6cc
1 changed files with 38 additions and 58 deletions
94
proc.cpp
94
proc.cpp
|
@ -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,71 +1222,57 @@ 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))
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
{
|
{
|
||||||
case 1:
|
read_try(j);
|
||||||
{
|
process_mark_finished_children(false);
|
||||||
read_try(j);
|
break;
|
||||||
process_mark_finished_children(false);
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
/* No FDs are ready. Look for finished processes. */
|
/* No FDs are ready. Look for finished processes. */
|
||||||
process_mark_finished_children(false);
|
process_mark_finished_children(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case -1:
|
case -1:
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
If there is no funky IO magic, we can use
|
||||||
|
waitpid instead of handling child deaths
|
||||||
|
through signals. This gives a rather large
|
||||||
|
speed boost (A factor 3 startup time
|
||||||
|
improvement on my 300 MHz machine) on
|
||||||
|
short-lived jobs.
|
||||||
|
*/
|
||||||
|
int processed = process_mark_finished_children(true);
|
||||||
|
if (processed < 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
If there is no funky IO magic, we can use
|
This probably means we got a
|
||||||
waitpid instead of handling child deaths
|
signal. A signal might mean that the
|
||||||
through signals. This gives a rather large
|
terminal emulator sent us a hup
|
||||||
speed boost (A factor 3 startup time
|
signal to tell is to close. If so,
|
||||||
improvement on my 300 MHz machine) on
|
we should exit.
|
||||||
short-lived jobs.
|
|
||||||
*/
|
*/
|
||||||
int processed = process_mark_finished_children(true);
|
if (reader_exit_forced())
|
||||||
if (processed < 0)
|
|
||||||
{
|
{
|
||||||
/*
|
quit = 1;
|
||||||
This probably means we got a
|
|
||||||
signal. A signal might mean that the
|
|
||||||
terminal emulator sent us a hup
|
|
||||||
signal to tell is to close. If so,
|
|
||||||
we should exit.
|
|
||||||
*/
|
|
||||||
if (reader_exit_forced())
|
|
||||||
{
|
|
||||||
quit = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue