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:
2025-09-07 11:45:54 -04:00
parent f587b45b38
commit 6ba6cb9cf0
+13 -3
View File
@@ -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();
}
);