* Fix a locking issue in the EventQueue

trunk
Teravus Ovares 2009-07-31 20:53:35 +00:00
parent 482e907520
commit ae8d3ab22e
1 changed files with 22 additions and 10 deletions

View File

@ -329,17 +329,26 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
public bool HasEvents(UUID agentID)
{
Queue<OSD> queue = TryGetQueue(agentID);
lock (queue)
{
if (queue.Count > 0)
return true;
else
return false;
}
}
public Hashtable GetEvents(UUID pAgentId, string request)
{
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,12 +366,15 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
else
{
array.Add(element);
lock (queue)
{
while (queue.Count > 0)
{
array.Add(queue.Dequeue());
thisID++;
}
}
}
OSDMap events = new OSDMap();
events.Add("events", array);