* Fix a locking issue in the EventQueue
parent
482e907520
commit
ae8d3ab22e
|
@ -329,17 +329,26 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
|
||||||
public bool HasEvents(UUID agentID)
|
public bool HasEvents(UUID agentID)
|
||||||
{
|
{
|
||||||
Queue<OSD> queue = TryGetQueue(agentID);
|
Queue<OSD> queue = TryGetQueue(agentID);
|
||||||
if (queue.Count > 0)
|
lock (queue)
|
||||||
return true;
|
{
|
||||||
else
|
if (queue.Count > 0)
|
||||||
return false;
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Hashtable GetEvents(UUID pAgentId, string request)
|
public Hashtable GetEvents(UUID pAgentId, string request)
|
||||||
{
|
{
|
||||||
Queue<OSD> queue = TryGetQueue(pAgentId);
|
Queue<OSD> queue = TryGetQueue(pAgentId);
|
||||||
OSD element = queue.Dequeue(); // 15s timeout
|
OSD element;
|
||||||
|
lock (queue)
|
||||||
|
{
|
||||||
|
if (queue.Count == 0)
|
||||||
|
return NoEvents();
|
||||||
|
element = queue.Dequeue(); // 15s timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -357,10 +366,13 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
array.Add(element);
|
array.Add(element);
|
||||||
while (queue.Count > 0)
|
lock (queue)
|
||||||
{
|
{
|
||||||
array.Add(queue.Dequeue());
|
while (queue.Count > 0)
|
||||||
thisID++;
|
{
|
||||||
|
array.Add(queue.Dequeue());
|
||||||
|
thisID++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue