Implement signal handler for SIGTERM.

Fixes #5087
This commit is contained in:
Gunnar Beutner 2013-11-17 19:58:32 +01:00
parent 37d9ccde94
commit 1676af8b2d
2 changed files with 6 additions and 5 deletions

View File

@ -327,17 +327,17 @@ void Application::DisplayBugMessage(void)
#ifndef _WIN32
/**
* Signal handler for SIGINT. Prepares the application for cleanly
* Signal handler for SIGINT and SIGTERM. Prepares the application for cleanly
* shutting down during the next execution of the event loop.
*
* @param - The signal number.
*/
void Application::SigIntHandler(int)
void Application::SigIntTermHandler(int signum)
{
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
sa.sa_handler = SIG_DFL;
sigaction(SIGINT, &sa, NULL);
sigaction(signum, &sa, NULL);
Application::Ptr instance = Application::GetInstance();
@ -466,8 +466,9 @@ int Application::Run(void)
#ifndef _WIN32
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
sa.sa_handler = &Application::SigIntHandler;
sa.sa_handler = &Application::SigIntTermHandler;
sigaction(SIGINT, &sa, NULL);
sigaction(SIGTERM, &sa, NULL);
sa.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &sa, NULL);

View File

@ -116,7 +116,7 @@ private:
static double m_StartTime;
#ifndef _WIN32
static void SigIntHandler(int signum);
static void SigIntTermHandler(int signum);
#else /* _WIN32 */
static BOOL WINAPI CtrlHandler(DWORD type);
static LONG WINAPI SEHUnhandledExceptionFilter(PEXCEPTION_POINTERS exi);