attempt to try to fix mantis issue # 613, which seems to be a threading issue. Queue is only threadsafe if its a public static member, which in this case it wasn't. And we were locking it during both enqueues and dequeues. So have added those locks to a syncObject. But it still needs testing on a high load region, as that seems to be when the exception happened.

0.6.0-stable
MW 2008-03-14 14:40:31 +00:00
parent 3778840f36
commit a5f5be8a0c
1 changed files with 8 additions and 8 deletions

View File

@ -43,6 +43,8 @@ namespace OpenSim.Region.Environment.Types
private List<LLUUID> m_ids;
private object m_syncObject = new object();
public int Count
{
get { return m_queue.Count; }
@ -53,21 +55,19 @@ namespace OpenSim.Region.Environment.Types
m_queue = new Queue<SceneObjectPart>();
m_ids = new List<LLUUID>();
}
public void Clear()
{
lock (m_ids)
lock (m_syncObject)
{
m_ids.Clear();
}
lock (m_queue)
{
m_queue.Clear();
}
}
public void Enqueue(SceneObjectPart part)
{
lock (m_ids)
lock (m_syncObject)
{
if (!m_ids.Contains(part.UUID))
{
@ -80,11 +80,11 @@ namespace OpenSim.Region.Environment.Types
public SceneObjectPart Dequeue()
{
SceneObjectPart part = null;
lock (m_syncObject)
{
if (m_queue.Count > 0)
{
part = m_queue.Dequeue();
lock (m_ids)
{
m_ids.Remove(part.UUID);
}
}