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.avinationmerge
parent
b5ac2eb1e1
commit
97ff01a0c2
|
@ -123,14 +123,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
if (Timers.Count == 0)
|
||||
return;
|
||||
|
||||
Dictionary<string, TimerInfo>.ValueCollection tvals;
|
||||
Dictionary<string, TimerInfo> tvals;
|
||||
lock (TimerListLock)
|
||||
{
|
||||
// Go through all timers
|
||||
tvals = Timers.Values;
|
||||
tvals = new Dictionary<string, TimerInfo>(Timers);
|
||||
}
|
||||
|
||||
foreach (TimerInfo ts in tvals)
|
||||
foreach (TimerInfo ts in tvals.Values)
|
||||
{
|
||||
// Time has passed?
|
||||
if (ts.next < DateTime.Now.Ticks)
|
||||
|
|
Loading…
Reference in New Issue