From b2ed348aa2746fbf034b713d006e40366c479d5a Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Thu, 22 Oct 2009 12:33:23 -0700 Subject: 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 --- OpenSim/Region/Application/OpenSim.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'OpenSim/Region/Application/OpenSim.cs') 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 m_scriptTimer.Elapsed += RunAutoTimerScript; } + // Hook up to the watchdog timer + Watchdog.OnWatchdogTimeout += WatchdogTimeoutHandler; + PrintFileToConsole("startuplogo.txt"); // For now, start at the 'root' level by default @@ -384,6 +387,14 @@ namespace OpenSim } } + private void WatchdogTimeoutHandler(System.Threading.Thread thread, int lastTick) + { + int now = Environment.TickCount & Int32.MaxValue; + + m_log.ErrorFormat("[WATCHDOG]: Timeout detected for thread \"{0}\". ThreadState={1}. Last tick was {2}ms ago", + thread.Name, thread.ThreadState, now - lastTick); + } + #region Console Commands /// -- cgit v1.1