debug_thread_error to wait for a signal instead of sleep

Allows for control-C out of it
This commit is contained in:
ridiculousfish 2019-05-21 18:39:01 -07:00
parent 6d20b3984a
commit 363652ad76
2 changed files with 6 additions and 1 deletions

View file

@ -2269,7 +2269,11 @@ void append_path_component(wcstring &path, const wcstring &component) {
extern "C" { extern "C" {
[[gnu::noinline]] void debug_thread_error(void) { [[gnu::noinline]] void debug_thread_error(void) {
while (1) sleep(9999999); // Wait for a SIGINT. We can't use sigsuspend() because the signal may be delivered on another
// thread.
auto &tm = topic_monitor_t::principal();
auto gens = tm.current_generations();
tm.check(&gens, {topic_t::sighupint}, true /* wait */);
} }
} }

View file

@ -255,6 +255,7 @@ static void handle_int_notinteractive(int sig, siginfo_t *info, void *context) {
if (reraise_if_forked_child(sig)) return; if (reraise_if_forked_child(sig)) return;
parser_t::skip_all_blocks(); parser_t::skip_all_blocks();
default_handler(sig, info, context); default_handler(sig, info, context);
topic_monitor_t::principal().post(topic_t::sighupint);
} }
/// sigchld handler. Does notification and calls the handler in proc.c. /// sigchld handler. Does notification and calls the handler in proc.c.