aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llcommon/llapp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llcommon/llapp.cpp')
-rw-r--r--linden/indra/llcommon/llapp.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/linden/indra/llcommon/llapp.cpp b/linden/indra/llcommon/llapp.cpp
index b0751b8..2347ac9 100644
--- a/linden/indra/llcommon/llapp.cpp
+++ b/linden/indra/llcommon/llapp.cpp
@@ -47,6 +47,7 @@
47// 47//
48#if LL_WINDOWS 48#if LL_WINDOWS
49LONG WINAPI default_windows_exception_handler(struct _EXCEPTION_POINTERS *exception_infop); 49LONG WINAPI default_windows_exception_handler(struct _EXCEPTION_POINTERS *exception_infop);
50BOOL ConsoleCtrlHandler(DWORD fdwCtrlType);
50#else 51#else
51#include <unistd.h> // for fork() 52#include <unistd.h> // for fork()
52void setup_signals(); 53void setup_signals();
@@ -219,6 +220,11 @@ void LLApp::setupErrorHandling()
219 // Disable this until the viewer gets ported so server crashes can be JIT debugged. 220 // Disable this until the viewer gets ported so server crashes can be JIT debugged.
220 //LPTOP_LEVEL_EXCEPTION_FILTER prev_filter; 221 //LPTOP_LEVEL_EXCEPTION_FILTER prev_filter;
221 //prev_filter = SetUnhandledExceptionFilter(default_windows_exception_handler); 222 //prev_filter = SetUnhandledExceptionFilter(default_windows_exception_handler);
223
224 // This sets a callback to handle w32 signals to the console window.
225 // The viewer shouldn't be affected, sicne its a windowed app.
226 SetConsoleCtrlHandler( (PHANDLER_ROUTINE) ConsoleCtrlHandler, TRUE);
227
222#else 228#else
223 // 229 //
224 // Start up signal handling. 230 // Start up signal handling.
@@ -399,6 +405,34 @@ LONG WINAPI default_windows_exception_handler(struct _EXCEPTION_POINTERS *except
399 return retval; 405 return retval;
400} 406}
401 407
408// Win32 doesn't support signals. This is used instead.
409BOOL ConsoleCtrlHandler(DWORD fdwCtrlType)
410{
411 switch (fdwCtrlType)
412 {
413 case CTRL_BREAK_EVENT:
414 case CTRL_LOGOFF_EVENT:
415 case CTRL_SHUTDOWN_EVENT:
416 case CTRL_CLOSE_EVENT: // From end task or the window close button.
417 case CTRL_C_EVENT: // from CTRL-C on the keyboard
418 // Just set our state to quitting, not error
419 if (LLApp::isQuitting() || LLApp::isError())
420 {
421 // We're already trying to die, just ignore this signal
422 if (LLApp::sLogInSignal)
423 {
424 llinfos << "Signal handler - Already trying to quit, ignoring signal!" << llendl;
425 }
426 return TRUE;
427 }
428 LLApp::setQuitting();
429 return TRUE;
430
431 default:
432 return FALSE;
433 }
434}
435
402#else //!LL_WINDOWS 436#else //!LL_WINDOWS
403void LLApp::setChildCallback(pid_t pid, LLAppChildCallback callback) 437void LLApp::setChildCallback(pid_t pid, LLAppChildCallback callback)
404{ 438{