diff options
author | Justin Clark-Casey (justincc) | 2012-08-18 00:46:34 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-08-18 00:46:34 +0100 |
commit | e4e5237086bd34a6649b687d3499a6795317f043 (patch) | |
tree | 8f87f8fe7ea489dbd7a3ab66cf0ca75605ceba7a /OpenSim/Framework | |
parent | adding null return to fix building (diff) | |
download | opensim-SC_OLD-e4e5237086bd34a6649b687d3499a6795317f043.zip opensim-SC_OLD-e4e5237086bd34a6649b687d3499a6795317f043.tar.gz opensim-SC_OLD-e4e5237086bd34a6649b687d3499a6795317f043.tar.bz2 opensim-SC_OLD-e4e5237086bd34a6649b687d3499a6795317f043.tar.xz |
When reporting a thread timeout, create a copy of the info rather than passing the original ThreadWatchdogInfo structure.
This is to avoid the possibility of misleading reporting if a watchdog update outraces an alarm.
Should address any remaining issues from http://opensimulator.org/mantis/view.php?id=6012
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Monitoring/Watchdog.cs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index 02f11fa..7964f28 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs | |||
@@ -89,6 +89,17 @@ namespace OpenSim.Framework.Monitoring | |||
89 | FirstTick = Environment.TickCount & Int32.MaxValue; | 89 | FirstTick = Environment.TickCount & Int32.MaxValue; |
90 | LastTick = FirstTick; | 90 | LastTick = FirstTick; |
91 | } | 91 | } |
92 | |||
93 | public ThreadWatchdogInfo(ThreadWatchdogInfo previousTwi) | ||
94 | { | ||
95 | Thread = previousTwi.Thread; | ||
96 | FirstTick = previousTwi.FirstTick; | ||
97 | LastTick = previousTwi.LastTick; | ||
98 | Timeout = previousTwi.Timeout; | ||
99 | IsTimedOut = previousTwi.IsTimedOut; | ||
100 | AlarmIfTimeout = previousTwi.AlarmIfTimeout; | ||
101 | AlarmMethod = previousTwi.AlarmMethod; | ||
102 | } | ||
92 | } | 103 | } |
93 | 104 | ||
94 | /// <summary> | 105 | /// <summary> |
@@ -335,7 +346,9 @@ namespace OpenSim.Framework.Monitoring | |||
335 | if (callbackInfos == null) | 346 | if (callbackInfos == null) |
336 | callbackInfos = new List<ThreadWatchdogInfo>(); | 347 | callbackInfos = new List<ThreadWatchdogInfo>(); |
337 | 348 | ||
338 | callbackInfos.Add(threadInfo); | 349 | // Send a copy of the watchdog info to prevent race conditions where the watchdog |
350 | // thread updates the monitoring info after an alarm has been sent out. | ||
351 | callbackInfos.Add(new ThreadWatchdogInfo(threadInfo)); | ||
339 | } | 352 | } |
340 | } | 353 | } |
341 | } | 354 | } |