aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMW2008-03-14 14:40:31 +0000
committerMW2008-03-14 14:40:31 +0000
commita5f5be8a0c5cd43139146b6e66a874fc25ab9be7 (patch)
treea04955d943201a2887f2b8da2f96aa43b71a8aa5
parentUpdate svn properties. (diff)
downloadopensim-SC-a5f5be8a0c5cd43139146b6e66a874fc25ab9be7.zip
opensim-SC-a5f5be8a0c5cd43139146b6e66a874fc25ab9be7.tar.gz
opensim-SC-a5f5be8a0c5cd43139146b6e66a874fc25ab9be7.tar.bz2
opensim-SC-a5f5be8a0c5cd43139146b6e66a874fc25ab9be7.tar.xz
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.
-rw-r--r--OpenSim/Region/Environment/Types/UpdateQueue.cs16
1 files changed, 8 insertions, 8 deletions
diff --git a/OpenSim/Region/Environment/Types/UpdateQueue.cs b/OpenSim/Region/Environment/Types/UpdateQueue.cs
index ce0927c..391c50c 100644
--- a/OpenSim/Region/Environment/Types/UpdateQueue.cs
+++ b/OpenSim/Region/Environment/Types/UpdateQueue.cs
@@ -43,6 +43,8 @@ namespace OpenSim.Region.Environment.Types
43 43
44 private List<LLUUID> m_ids; 44 private List<LLUUID> m_ids;
45 45
46 private object m_syncObject = new object();
47
46 public int Count 48 public int Count
47 { 49 {
48 get { return m_queue.Count; } 50 get { return m_queue.Count; }
@@ -53,21 +55,19 @@ namespace OpenSim.Region.Environment.Types
53 m_queue = new Queue<SceneObjectPart>(); 55 m_queue = new Queue<SceneObjectPart>();
54 m_ids = new List<LLUUID>(); 56 m_ids = new List<LLUUID>();
55 } 57 }
58
56 public void Clear() 59 public void Clear()
57 { 60 {
58 lock (m_ids) 61 lock (m_syncObject)
59 { 62 {
60 m_ids.Clear(); 63 m_ids.Clear();
61 }
62 lock (m_queue)
63 {
64 m_queue.Clear(); 64 m_queue.Clear();
65 } 65 }
66 } 66 }
67 67
68 public void Enqueue(SceneObjectPart part) 68 public void Enqueue(SceneObjectPart part)
69 { 69 {
70 lock (m_ids) 70 lock (m_syncObject)
71 { 71 {
72 if (!m_ids.Contains(part.UUID)) 72 if (!m_ids.Contains(part.UUID))
73 { 73 {
@@ -80,11 +80,11 @@ namespace OpenSim.Region.Environment.Types
80 public SceneObjectPart Dequeue() 80 public SceneObjectPart Dequeue()
81 { 81 {
82 SceneObjectPart part = null; 82 SceneObjectPart part = null;
83 if (m_queue.Count > 0) 83 lock (m_syncObject)
84 { 84 {
85 part = m_queue.Dequeue(); 85 if (m_queue.Count > 0)
86 lock (m_ids)
87 { 86 {
87 part = m_queue.Dequeue();
88 m_ids.Remove(part.UUID); 88 m_ids.Remove(part.UUID);
89 } 89 }
90 } 90 }