Port debug_thread_error() to Rust

This commit is contained in:
ridiculousfish 2023-05-28 15:32:21 -07:00 committed by Peter Ammon
parent 38ac21ba5e
commit 76205e5b55
2 changed files with 12 additions and 8 deletions

View File

@ -947,6 +947,17 @@ pub const fn char_offset(base: char, offset: u32) -> char {
}
}
#[no_mangle]
#[inline(never)]
fn debug_thread_error() {
// Wait for a SIGINT. We can't use sigsuspend() because the signal may be delivered on another
// thread.
use crate::signal::SigChecker;
use crate::topic_monitor::topic_t;
let sigint = SigChecker::new(topic_t::sighupint);
sigint.wait();
}
/// Exits without invoking destructors (via _exit), useful for code after fork.
pub fn exit_without_destructors(code: i32) -> ! {
unsafe { libc::_exit(code) };

View File

@ -1364,14 +1364,7 @@ double timef() {
void exit_without_destructors(int code) { _exit(code); }
extern "C" {
[[gnu::noinline]] void debug_thread_error(void) {
// Wait for a SIGINT. We can't use sigsuspend() because the signal may be delivered on another
// thread.
sigchecker_t sigint(topic_t::sighupint);
sigint.wait();
}
}
extern "C" void debug_thread_error();
void save_term_foreground_process_group() { initial_fg_process_group = tcgetpgrp(STDIN_FILENO); }