aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llwatchdog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llwatchdog.cpp')
-rw-r--r--linden/indra/newview/llwatchdog.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/linden/indra/newview/llwatchdog.cpp b/linden/indra/newview/llwatchdog.cpp
index 55975ee..cc49848 100644
--- a/linden/indra/newview/llwatchdog.cpp
+++ b/linden/indra/newview/llwatchdog.cpp
@@ -4,7 +4,7 @@
4 * 4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$ 5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 * 6 *
7 * Copyright (c) 2007-2008, Linden Research, Inc. 7 * Copyright (c) 2007-2009, Linden Research, Inc.
8 * 8 *
9 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 10 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -35,6 +35,15 @@
35 35
36const U32 WATCHDOG_SLEEP_TIME_USEC = 1000000; 36const U32 WATCHDOG_SLEEP_TIME_USEC = 1000000;
37 37
38void default_killer_callback()
39{
40#ifdef LL_WINDOWS
41 RaiseException(0,0,0,0);
42#else
43 raise(SIGQUIT);
44#endif
45}
46
38// This class runs the watchdog timing thread. 47// This class runs the watchdog timing thread.
39class LLWatchdogTimerThread : public LLThread 48class LLWatchdogTimerThread : public LLThread
40{ 49{
@@ -52,7 +61,7 @@ public:
52 void stop() 61 void stop()
53 { 62 {
54 mStopping = true; 63 mStopping = true;
55 ms_sleep(1); 64 mSleepMsecs = 1;
56 } 65 }
57 66
58 /* virtual */ void run() 67 /* virtual */ void run()
@@ -146,7 +155,8 @@ void LLWatchdogTimeout::ping(const std::string& state)
146LLWatchdog::LLWatchdog() : 155LLWatchdog::LLWatchdog() :
147 mSuspectsAccessMutex(NULL), 156 mSuspectsAccessMutex(NULL),
148 mTimer(NULL), 157 mTimer(NULL),
149 mLastClockCount(0) 158 mLastClockCount(0),
159 mKillerCallback(&default_killer_callback)
150{ 160{
151} 161}
152 162
@@ -168,8 +178,9 @@ void LLWatchdog::remove(LLWatchdogEntry* e)
168 unlockThread(); 178 unlockThread();
169} 179}
170 180
171void LLWatchdog::init() 181void LLWatchdog::init(killer_event_callback func)
172{ 182{
183 mKillerCallback = func;
173 if(!mSuspectsAccessMutex && !mTimer) 184 if(!mSuspectsAccessMutex && !mTimer)
174 { 185 {
175 mSuspectsAccessMutex = new LLMutex(NULL); 186 mSuspectsAccessMutex = new LLMutex(NULL);
@@ -238,11 +249,7 @@ void LLWatchdog::run()
238 } 249 }
239 250
240 llinfos << "Watchdog detected error:" << llendl; 251 llinfos << "Watchdog detected error:" << llendl;
241#ifdef LL_WINDOWS 252 mKillerCallback();
242 RaiseException(0,0,0,0);
243#else
244 raise(SIGQUIT);
245#endif
246 } 253 }
247 } 254 }
248 255