Skip to content
Snippets Groups Projects
Commit c960dff8 authored by René Fritze's avatar René Fritze
Browse files

it is now possible to install signal handlers. An example for SIGINT is implemented

parent 5a000caf
No related branches found
No related tags found
No related merge requests found
#ifndef DUNE_STUFF_SIGNALS
#define DUNE_STUFF_SIGNALS
#include <signal.h>
#include <dune/stuff/logging.hh>
namespace Stuff {
void handleInterrupt(int signal)
{
Logger().Info() << "forcefully terminated at " << Logging::TimeString() << std::endl;
Logger().Flush();
exit(signal);
}
void installSignalHandlers()
{
struct sigaction new_action;
/* Set up the structure to specify the new action. */
new_action.sa_handler = handleInterrupt;
sigemptyset(&new_action.sa_mask);
new_action.sa_flags = 0;
sigaction(SIGINT, &new_action, NULL);
}
} // end namepsace stuff
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment