cosmetics

This commit is contained in:
UbitUmarov
2019-01-29 21:16:28 +00:00
parent 6479eb9022
commit dc633ee768
3 changed files with 34 additions and 22 deletions

View File

@@ -477,30 +477,48 @@ namespace OpenSim.Framework
public TValue[] GetArray()
{
TValue[] ret = new TValue[0];
bool gotLock = false;
bool gotupLock = false;
try
{
try { }
finally
{
rwLock.EnterWriteLock();
gotLock = true;
rwLock.EnterUpgradeableReadLock();
gotupLock = true;
}
if (m_array == null)
if (m_array == null)
{
bool gotwritelock = false;
try
{
try { }
finally
{
rwLock.EnterWriteLock();
gotwritelock = true;
}
m_array = new TValue[Dictionary1.Count];
Dictionary1.Values.CopyTo(m_array, 0);
}
ret = m_array;
finally
{
if (gotwritelock)
rwLock.ExitWriteLock();
}
}
return m_array;
}
catch
{
return new TValue[0];
}
finally
{
if (gotLock)
rwLock.ExitWriteLock();
if (gotupLock)
rwLock.ExitUpgradeableReadLock();
}
return ret;
}
}
}