我使用boost信号处理程序是为了在信号到达时正确地拆除我的进程(SIGTERM、SIGSEGV和SIGABRT)。
然而,在拆除进程之后,我想继续默认的信号处理系统流程(终止进程并生成崩溃转储文件)。
我应该如何从回调中调用这个默认处理程序?
谢谢
#include <boost/asio/signal_set.hpp>
void signal_handler() {
boost::thread([](){
boost::asio::io_context io_context;
boost::asio::signal_set signals(io_context, SIGTERM, SIGSEGV, SIGABRT);
spdlog::debug("Started waiting for signals");
signals.async_wait([](const boost::system::error_code& error,
int signal_number) {
if (!error) {
print(std::fmt("got signal {}. teardown the process", signal_number));
teardown();
} else {
print("error in getting the signal");
}
// HERE I'd like to call the standard signal handler in order to produce crash
// dump file and kill the process.
});
io_context.run();
});
}