Fix to existing ReaderWriterLockSlim implementations

avinationmerge
CasperW 2009-12-06 17:23:07 +01:00
parent 1e222d52e6
commit 172e2f4e76
4 changed files with 26 additions and 7 deletions

View File

@ -108,10 +108,13 @@ namespace OpenSim.Framework
}
}
else
{
if (m_itemLock.RecursiveReadCount>0)
{
m_itemLock.ExitReadLock();
}
}
}
/// <summary>
/// Lock our inventory list for writing (many can read, one can write)
@ -143,10 +146,13 @@ namespace OpenSim.Framework
LockedByThread = Thread.CurrentThread;
}
else
{
if (m_itemLock.RecursiveWriteCount > 0)
{
m_itemLock.ExitWriteLock();
}
}
}
#region ICloneable Members

View File

@ -125,10 +125,13 @@ namespace OpenSim.Region.Framework.Scenes
}
}
else
{
if (m_partsLock.RecursiveReadCount > 0)
{
m_partsLock.ExitReadLock();
}
}
}
public void lockPartsForWrite(bool locked)
{
if (locked)
@ -154,10 +157,13 @@ namespace OpenSim.Region.Framework.Scenes
}
}
else
{
if (m_partsLock.RecursiveWriteCount > 0)
{
m_partsLock.ExitWriteLock();
}
}
}
public bool HasGroupChanged
{

View File

@ -320,17 +320,18 @@ namespace OpenSim.Region.Framework.Scenes
{
if (m_items.ContainsKey(itemId))
{
m_items.LockItemsForRead(false);
CreateScriptInstance(m_items[itemId], startParam, postOnRez, engine, stateSource);
}
else
{
m_items.LockItemsForRead(false);
m_log.ErrorFormat(
"[PRIM INVENTORY]: " +
"Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}",
itemId, m_part.Name, m_part.UUID,
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
}
m_items.LockItemsForRead(false);
}
else
{

View File

@ -149,10 +149,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
}
}
else
{
if (m_scriptsLock.RecursiveReadCount > 0)
{
m_scriptsLock.ExitReadLock();
}
}
}
private void lockScriptsForWrite(bool locked)
{
if (locked)
@ -178,10 +181,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
}
}
else
{
if (m_scriptsLock.RecursiveWriteCount > 0)
{
m_scriptsLock.ExitWriteLock();
}
}
}
public string ScriptEngineName
{