This commit is contained in:
hinger_v 2025-03-13 16:49:55 +01:00
parent 9508dd1adc
commit 222d9e4839

View File

@ -13,6 +13,7 @@
#include "singlePhotonDetector.h"
#include <fstream>
#include <csignal>
#include <map>
#include <memory>
#include <stdio.h>
@ -88,6 +89,13 @@ int adjustThreads(int requestedThreads, int nSC) {
return adjustedThreads;
}
// Signal handler for segmentation faults
void signal_handler(int signum) {
std::cerr << "Caught signal " << signum << ": Segmentation fault (core dump)" << std::endl;
// Handle the error (e.g., clean up, abort, etc.)
exit(signum); // Exit program with the signal code
}
int main(int argc, char *argv[]) {
@ -103,6 +111,9 @@ int main(int argc, char *argv[]) {
return 1;
}
// Set up the signal handler for segmentation faults
signal(SIGSEGV, signal_handler);
int const fifosize = 100; //1000;
int const nthreads = 10;
int const csize = 3; // 3