diff options
author | Melanie Thielker | 2015-03-23 22:15:25 +0100 |
---|---|---|
committer | Melanie Thielker | 2015-03-23 22:15:25 +0100 |
commit | 97ff01a0c2d19100aa90484ccf9e17b16903af71 (patch) | |
tree | e58d7dffb98f0415566d77f58145e21834be61bf | |
parent | Allow setting the size of the wearables array from config, for core compatibi... (diff) | |
download | opensim-SC-97ff01a0c2d19100aa90484ccf9e17b16903af71.zip opensim-SC-97ff01a0c2d19100aa90484ccf9e17b16903af71.tar.gz opensim-SC-97ff01a0c2d19100aa90484ccf9e17b16903af71.tar.bz2 opensim-SC-97ff01a0c2d19100aa90484ccf9e17b16903af71.tar.xz |
Taking a reference to the value collection is not thread safe. Change this
to create a shallow copy instead and then iterate it's values to avoid the
"out of sync" error.
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs index 68aacd2..5b1fdc0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs | |||
@@ -123,14 +123,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
123 | if (Timers.Count == 0) | 123 | if (Timers.Count == 0) |
124 | return; | 124 | return; |
125 | 125 | ||
126 | Dictionary<string, TimerInfo>.ValueCollection tvals; | 126 | Dictionary<string, TimerInfo> tvals; |
127 | lock (TimerListLock) | 127 | lock (TimerListLock) |
128 | { | 128 | { |
129 | // Go through all timers | 129 | // Go through all timers |
130 | tvals = Timers.Values; | 130 | tvals = new Dictionary<string, TimerInfo>(Timers); |
131 | } | 131 | } |
132 | 132 | ||
133 | foreach (TimerInfo ts in tvals) | 133 | foreach (TimerInfo ts in tvals.Values) |
134 | { | 134 | { |
135 | // Time has passed? | 135 | // Time has passed? |
136 | if (ts.next < DateTime.Now.Ticks) | 136 | if (ts.next < DateTime.Now.Ticks) |