本文整理汇总了C++中SignalHandler::run方法的典型用法代码示例。如果您正苦于以下问题:C++ SignalHandler::run方法的具体用法?C++ SignalHandler::run怎么用?C++ SignalHandler::run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SignalHandler
的用法示例。
在下文中一共展示了SignalHandler::run方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: start_signals
void Environment::start_signals() {
#ifndef RBX_WINDOWS
struct sigaction action;
action.sa_handler = null_func;
action.sa_flags = 0;
sigfillset(&action.sa_mask);
sigaction(SIGVTALRM, &action, NULL);
#endif
state->set_run_signals(true);
SignalHandler* handler = new SignalHandler(state);
shared->set_signal_handler(handler);
handler->run(state);
#ifndef RBX_WINDOWS
// Ignore sigpipe.
signal(SIGPIPE, SIG_IGN);
// Some extensions expect SIGALRM to be defined, because MRI does.
// We'll just use a noop for it.
signal(SIGALRM, null_func);
// If we have execinfo, setup some crash handlers
#ifdef USE_EXECINFO
if(!getenv("DISABLE_SEGV")) {
signal(SIGSEGV, segv_handler);
signal(SIGBUS, segv_handler);
signal(SIGILL, segv_handler);
signal(SIGFPE, segv_handler);
signal(SIGABRT, segv_handler);
// Force glibc to load the shared library containing backtrace()
// now, so that we don't have to try and load it in the signal
// handler.
void* ary[1];
backtrace(ary, 1);
}
#endif // USE_EXEC_INFO
// Setup some other signal that normally just cause the process
// to terminate so that we print out a message, then terminate.
signal(SIGHUP, quit_handler);
signal(SIGUSR1, quit_handler);
signal(SIGUSR2, quit_handler);
#endif // ifndef RBX_WINDOWS
signal(SIGTERM, quit_handler);
}