mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 14:16:07 +08:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user