m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue.");
m_itemLock.ExitReadLock();
}
if(m_itemLock.RecursiveWriteCount>0)
{
m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed.");
m_itemLock.ExitWriteLock();
}
while(!m_itemLock.TryEnterReadLock(60000))
{
m_log.Error("Thread lock detected while trying to aquire READ lock in TaskInventoryDictionary. Locked by thread "+LockedByThread.Name+". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed.");
/// Lock our inventory list for writing (many can read, one can write)
/// </summary>
publicvoidLockItemsForWrite(boollocked)
{
if(locked)
{
//Enter a write lock, wait indefinately for one to open.
if(m_itemLock.RecursiveReadCount>0)
{
m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue.");
m_itemLock.ExitReadLock();
}
if(m_itemLock.RecursiveWriteCount>0)
{
m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed.");
m_itemLock.ExitWriteLock();
}
while(!m_itemLock.TryEnterWriteLock(60000))
{
m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by thread "+LockedByThread.Name+". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed.");
// The alternative of simply serializing the list doesn't appear to work on mono, since
// we get a
//
// System.TypeInitializationException: An exception was thrown by the type initializer for OpenSim.Framework.TaskInventoryDictionary ---> System.ArgumentOutOfRangeException: < 0
// Parameter name: length
// at System.String.Substring (Int32 startIndex, Int32 length) [0x00088] in /build/buildd/mono-1.2.4/mcs/class/corlib/System/String.cs:381
// at System.Xml.Serialization.TypeTranslator.GetTypeData (System.Type runtimeType, System.String xmlDataType) [0x001f6] in /build/buildd/mono-1.2.4/mcs/class/System.XML/System.Xml.Serialization/TypeTranslator.cs:217
// ...
// private static XmlSerializer tiiSerializer
// = new XmlSerializer(typeof(Dictionary<UUID, TaskInventoryItem>.ValueCollection));
// see IXmlSerializable
#region IXmlSerializable Members
publicXmlSchemaGetSchema()
{
returnnull;
}
// see IXmlSerializable
publicvoidReadXml(XmlReaderreader)
{
// m_log.DebugFormat("[TASK INVENTORY]: ReadXml current node before actions, {0}", reader.Name);