Mrntt: Add ability to listen for SIGSEGV
But don't actually use it because it makes it difficult to exit SMO from the cmdline.
This commit is contained in:
@@ -49,12 +49,22 @@ void ComponentThread::marionetteMain(ComponentThread& self)
|
||||
bool callFinalizeReq = false;
|
||||
|
||||
try {
|
||||
// Register SIGINT (Ctrl+C) handler to request user shutdown
|
||||
// Register SIGINT (Ctrl+C) and SIGSEGV handlers
|
||||
signals.async_wait(
|
||||
[&self](const boost::system::error_code& ec, int /*signal*/)
|
||||
[&self](const boost::system::error_code& ec, int signal)
|
||||
{
|
||||
if (ec) { return; }
|
||||
// Post user shutdown indication
|
||||
|
||||
switch (signal) {
|
||||
case SIGINT:
|
||||
std::cerr << "SIGINT (Ctrl+C) received. Initiating shutdown..." << std::endl;
|
||||
break;
|
||||
case SIGSEGV:
|
||||
std::cerr << "FATAL: Segmentation fault detected. Initiating shutdown..." << std::endl;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
self.userShutdownInd();
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user