Take watchdog alarm calling back outside the m_threads lock.

This is how it was originally.  This stops a very long running alarm callback from causing a problem.
xassetservice
Justin Clark-Casey (justincc) 2012-02-24 05:25:18 +00:00
parent 9e6ffe7798
commit bafef292f4
2 changed files with 18 additions and 5 deletions

View File

@ -262,7 +262,7 @@ namespace OpenSim.Framework
if (callback != null)
{
ThreadWatchdogInfo timedOut = null;
List<ThreadWatchdogInfo> callbackInfos = null;
lock (m_threads)
{
@ -273,17 +273,30 @@ namespace OpenSim.Framework
if (threadInfo.Thread.ThreadState == ThreadState.Stopped)
{
RemoveThread(threadInfo.Thread.ManagedThreadId);
callback(threadInfo.Thread, threadInfo.LastTick);
if (callbackInfos == null)
callbackInfos = new List<ThreadWatchdogInfo>();
callbackInfos.Add(threadInfo);
}
else if (!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout)
{
threadInfo.IsTimedOut = true;
if (threadInfo.AlarmIfTimeout)
callback(threadInfo.Thread, threadInfo.LastTick);
{
if (callbackInfos == null)
callbackInfos = new List<ThreadWatchdogInfo>();
callbackInfos.Add(threadInfo);
}
}
}
}
if (callbackInfos != null)
foreach (ThreadWatchdogInfo callbackInfo in callbackInfos)
callback(callbackInfo.Thread, callbackInfo.LastTick);
}
m_watchdogTimer.Start();

View File

@ -156,8 +156,8 @@ namespace OpenSim.Region.Framework.Scenes
// that the region position is cached or performance will degrade
Utils.LongToUInts(regionHandle, out x, out y);
GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
bool v = true;
if (! simulatorList.Contains(dest.ServerURI))
// bool v = true;
if (!simulatorList.Contains(dest.ServerURI))
{
// we havent seen this simulator before, add it to the list
// and send it an update