Program Listing for File SignalHandlers.h

Return to documentation for file (include/flamegpu/detail/SignalHandlers.h)

#ifndef INCLUDE_FLAMEGPU_DETAIL_SIGNALHANDLERS_H_
#define INCLUDE_FLAMEGPU_DETAIL_SIGNALHANDLERS_H_
#include <cstdlib>
#include <csignal>

namespace flamegpu {
namespace detail {
class SignalHandlers {
 private:
static void handleSIGINT(int signum) {
    // Potentially do some graceful cleanup here. Not needed for now.
    // Close the application with the appropriate signal.
    std::exit(signum);
}
 public:
static void registerSignalHandlers(){
    // Register the handler method for SIGINT
    std::signal(SIGINT, handleSIGINT);
}
};

}  // namespace detail
}  // namespace flamegpu

#endif  // INCLUDE_FLAMEGPU_DETAIL_SIGNALHANDLERS_H_