consistently aborts immediately on ctrl-z (SIGTSTP)

This commit is contained in:
Joe Bryan 2019-04-22 19:41:24 -07:00
parent afb9911636
commit 075bc5109e
4 changed files with 27 additions and 8 deletions

View File

@ -530,13 +530,13 @@ report(void)
H2O_LIBRARY_VERSION_PATCH);
}
void
static void
_stop_exit(c3_i int_i)
{
u3l_log("\r\n[received keyboard stop signal, exiting]\r\n");
// XX crashes if we haven't started a pier yet
// explicit fprintf to avoid allocation in u3l_log
//
u3_pier_exit(u3_pier_stub());
fprintf(stderr, "\r\n[received keyboard stop signal, exiting]\r\n");
u3_daemon_bail();
}
/*
@ -664,6 +664,8 @@ main(c3_i argc,
// Block profiling signal, which should be delievered to exactly one thread.
//
// XX review, may be unnecessary due to similar in u3m_init()
//
if ( _(u3_Host.ops_u.pro) ) {
sigset_t set;

View File

@ -1260,7 +1260,7 @@
void
u3_pier_exit(u3_pier* pir_u);
/* u3_pier_bail(): clean up all event state.
/* u3_pier_bail(): immediately shutdown..
*/
void
u3_pier_bail(void);
@ -1334,6 +1334,11 @@
void
u3_daemon_commence();
/* u3_daemon_bail(): immediately shutdown.
*/
void
u3_daemon_bail(void);
/* u3_king_grab(): gc the daemon area
*/
void

View File

@ -796,6 +796,16 @@ u3_daemon_commence()
exit(0);
}
/* u3_daemon_bail(): immediately shutdown.
*/
void
u3_daemon_bail(void)
{
_daemon_loop_exit();
u3_pier_bail();
exit(1);
}
/* u3_daemon_grab(): gc the daemon area
*/
void

View File

@ -1985,14 +1985,16 @@ c3_rand(c3_w* rad_w)
}
}
/* u3_pier_bail(): clean up all event state.
/* u3_pier_bail(): immediately shutdown.
*/
void
u3_pier_bail(void)
{
fflush(stdout);
u3_pier_exit(u3_pier_stub());
if ( 0 != u3K.len_w ) {
_pier_exit_done(u3_pier_stub());
}
fflush(stdout);
exit(1);
}