aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares2009-07-31 20:53:35 +0000
committerTeravus Ovares2009-07-31 20:53:35 +0000
commitae8d3ab22e3bbbebda97c0bdc70d5c5edf5709c3 (patch)
tree67c23176232c2d049ad59cd4ed7dc43835d1a8ac /OpenSim/Region
parent* Reattempt at a compile (diff)
downloadopensim-SC_OLD-ae8d3ab22e3bbbebda97c0bdc70d5c5edf5709c3.zip
opensim-SC_OLD-ae8d3ab22e3bbbebda97c0bdc70d5c5edf5709c3.tar.gz
opensim-SC_OLD-ae8d3ab22e3bbbebda97c0bdc70d5c5edf5709c3.tar.bz2
opensim-SC_OLD-ae8d3ab22e3bbbebda97c0bdc70d5c5edf5709c3.tar.xz
* Fix a locking issue in the EventQueue
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs32
1 files changed, 22 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
index 3f0570e..8230401 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
@@ -329,19 +329,28 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
329 public bool HasEvents(UUID agentID) 329 public bool HasEvents(UUID agentID)
330 { 330 {
331 Queue<OSD> queue = TryGetQueue(agentID); 331 Queue<OSD> queue = TryGetQueue(agentID);
332 if (queue.Count > 0) 332 lock (queue)
333 return true; 333 {
334 else 334 if (queue.Count > 0)
335 return false; 335 return true;
336 336 else
337 return false;
338 }
339
337 } 340 }
338 341
339 public Hashtable GetEvents(UUID pAgentId, string request) 342 public Hashtable GetEvents(UUID pAgentId, string request)
340 { 343 {
341 Queue<OSD> queue = TryGetQueue(pAgentId); 344 Queue<OSD> queue = TryGetQueue(pAgentId);
342 OSD element = queue.Dequeue(); // 15s timeout 345 OSD element;
346 lock (queue)
347 {
348 if (queue.Count == 0)
349 return NoEvents();
350 element = queue.Dequeue(); // 15s timeout
351 }
352
343 353
344
345 354
346 int thisID = 0; 355 int thisID = 0;
347 lock (m_ids) 356 lock (m_ids)
@@ -357,10 +366,13 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
357 else 366 else
358 { 367 {
359 array.Add(element); 368 array.Add(element);
360 while (queue.Count > 0) 369 lock (queue)
361 { 370 {
362 array.Add(queue.Dequeue()); 371 while (queue.Count > 0)
363 thisID++; 372 {
373 array.Add(queue.Dequeue());
374 thisID++;
375 }
364 } 376 }
365 } 377 }
366 378