diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs
index 8a4894eb20..5fb725c79a 100644
--- a/OpenSim/Framework/Monitoring/Watchdog.cs
+++ b/OpenSim/Framework/Monitoring/Watchdog.cs
@@ -193,7 +193,7 @@ namespace OpenSim.Framework.Monitoring
m_watchdogTimer.Dispose();
m_watchdogTimer = null;
}
-
+
foreach(ThreadWatchdogInfo twi in m_threads.Values)
{
Thread t = twi.Thread;
@@ -341,6 +341,8 @@ namespace OpenSim.Framework.Monitoring
///
private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
{
+ if(!m_enabled)
+ return;
int now = Environment.TickCount & Int32.MaxValue;
int msElapsed = now - LastWatchdogThreadTick;
@@ -358,21 +360,26 @@ namespace OpenSim.Framework.Monitoring
List callbackInfos = null;
List threadsToRemove = null;
+ const ThreadState thgone = ThreadState.Stopped | ThreadState.Aborted | ThreadState.AbortRequested;
+
lock (m_threads)
{
foreach(ThreadWatchdogInfo threadInfo in m_threads.Values)
{
- if(threadInfo.Thread.ThreadState == ThreadState.Stopped)
+ if(!m_enabled)
+ return;
+ if(!threadInfo.Thread.IsAlive || (threadInfo.Thread.ThreadState & thgone) != 0)
{
if(threadsToRemove == null)
threadsToRemove = new List();
threadsToRemove.Add(threadInfo);
-
+/*
if(callbackInfos == null)
callbackInfos = new List();
callbackInfos.Add(threadInfo);
+*/
}
else if(!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout)
{
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 5977f40bf0..fcc87177a6 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -511,8 +511,6 @@ namespace OpenSim
private void WatchdogTimeoutHandler(Watchdog.ThreadWatchdogInfo twi)
{
int now = Environment.TickCount & Int32.MaxValue;
- if(twi.Thread.ThreadState == System.Threading.ThreadState.Stopped)
- return;
m_log.ErrorFormat(
"[WATCHDOG]: Timeout detected for thread \"{0}\". ThreadState={1}. Last tick was {2}ms ago. {3}",
twi.Thread.Name,