diff options
author | John Hurliman | 2009-10-22 12:33:23 -0700 |
---|---|---|
committer | John Hurliman | 2009-10-22 12:33:23 -0700 |
commit | b2ed348aa2746fbf034b713d006e40366c479d5a (patch) | |
tree | 26c114e88f54e64e1fdf17dcc7de1e54165db2bc /OpenSim/Region/Application/OpenSim.cs | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-b2ed348aa2746fbf034b713d006e40366c479d5a.zip opensim-SC_OLD-b2ed348aa2746fbf034b713d006e40366c479d5a.tar.gz opensim-SC_OLD-b2ed348aa2746fbf034b713d006e40366c479d5a.tar.bz2 opensim-SC_OLD-b2ed348aa2746fbf034b713d006e40366c479d5a.tar.xz |
Implemented a Watchdog class. Do not manually create Thread objects anymore, use Watchdog.StartThread(). While your thread is running call Watchdog.UpdateThread(). When it is shutting down call Watchdog.RemoveThread(). Most of the threads in OpenSim have been updated
Diffstat (limited to 'OpenSim/Region/Application/OpenSim.cs')
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 26298e7..0366d94 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -172,6 +172,9 @@ namespace OpenSim | |||
172 | m_scriptTimer.Elapsed += RunAutoTimerScript; | 172 | m_scriptTimer.Elapsed += RunAutoTimerScript; |
173 | } | 173 | } |
174 | 174 | ||
175 | // Hook up to the watchdog timer | ||
176 | Watchdog.OnWatchdogTimeout += WatchdogTimeoutHandler; | ||
177 | |||
175 | PrintFileToConsole("startuplogo.txt"); | 178 | PrintFileToConsole("startuplogo.txt"); |
176 | 179 | ||
177 | // For now, start at the 'root' level by default | 180 | // For now, start at the 'root' level by default |
@@ -384,6 +387,14 @@ namespace OpenSim | |||
384 | } | 387 | } |
385 | } | 388 | } |
386 | 389 | ||
390 | private void WatchdogTimeoutHandler(System.Threading.Thread thread, int lastTick) | ||
391 | { | ||
392 | int now = Environment.TickCount & Int32.MaxValue; | ||
393 | |||
394 | m_log.ErrorFormat("[WATCHDOG]: Timeout detected for thread \"{0}\". ThreadState={1}. Last tick was {2}ms ago", | ||
395 | thread.Name, thread.ThreadState, now - lastTick); | ||
396 | } | ||
397 | |||
387 | #region Console Commands | 398 | #region Console Commands |
388 | 399 | ||
389 | /// <summary> | 400 | /// <summary> |