we can't allow abort to change only one dic

0.9.0-post-fixes
UbitUmarov 2017-05-13 16:34:29 +01:00
parent 9ea49d107d
commit 16f02cb6fd
1 changed files with 34 additions and 30 deletions

View File

@ -74,8 +74,6 @@ namespace OpenSim.Framework
{
rwLock.EnterWriteLock();
gotLock = true;
}
if (Dictionary1.ContainsKey(key1))
{
if (!Dictionary2.ContainsKey(key2))
@ -86,10 +84,10 @@ namespace OpenSim.Framework
if (!Dictionary1.ContainsKey(key1))
throw new ArgumentException("key2 exists in the dictionary but not key1");
}
Dictionary1[key1] = value;
Dictionary2[key2] = value;
}
}
finally
{
if (gotLock)
@ -112,11 +110,10 @@ namespace OpenSim.Framework
{
rwLock.EnterWriteLock();
gotLock = true;
}
Dictionary1.Remove(key1);
success = Dictionary2.Remove(key2);
}
}
finally
{
if (gotLock)
@ -150,9 +147,13 @@ namespace OpenSim.Framework
foreach (KeyValuePair<TKey2, TValue> kvp in Dictionary2)
{
if (kvp.Value.Equals(value))
{
try { }
finally
{
Dictionary1.Remove(key1);
Dictionary2.Remove(kvp.Key);
}
found = true;
break;
}
@ -192,9 +193,13 @@ namespace OpenSim.Framework
foreach (KeyValuePair<TKey1, TValue> kvp in Dictionary1)
{
if (kvp.Value.Equals(value))
{
try { }
finally
{
Dictionary2.Remove(key2);
Dictionary1.Remove(kvp.Key);
}
found = true;
break;
}
@ -224,11 +229,10 @@ namespace OpenSim.Framework
{
rwLock.EnterWriteLock();
gotLock = true;
}
Dictionary1.Clear();
Dictionary2.Clear();
}
}
finally
{
if (gotLock)
@ -487,7 +491,6 @@ namespace OpenSim.Framework
{
rwLock.EnterWriteLock();
gotWriteLock = true;
}
for (int i = 0; i < list.Count; i++)
Dictionary1.Remove(list[i]);
@ -495,6 +498,7 @@ namespace OpenSim.Framework
for (int i = 0; i < list2.Count; i++)
Dictionary2.Remove(list2[i]);
}
}
finally
{
if (gotWriteLock)