aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/BlockingQueue.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/BlockingQueue.cs')
-rw-r--r--OpenSim/Framework/BlockingQueue.cs18
1 files changed, 8 insertions, 10 deletions
diff --git a/OpenSim/Framework/BlockingQueue.cs b/OpenSim/Framework/BlockingQueue.cs
index aef1192..daf99a8 100644
--- a/OpenSim/Framework/BlockingQueue.cs
+++ b/OpenSim/Framework/BlockingQueue.cs
@@ -97,11 +97,11 @@ namespace OpenSim.Framework
97 /// </remarks> 97 /// </remarks>
98 public bool Contains(T item) 98 public bool Contains(T item)
99 { 99 {
100 if (m_queue.Count < 1 && m_pqueue.Count < 1)
101 return false;
102
103 lock (m_queueSync) 100 lock (m_queueSync)
104 { 101 {
102 if (m_queue.Count < 1 && m_pqueue.Count < 1)
103 return false;
104
105 if (m_pqueue.Contains(item)) 105 if (m_pqueue.Contains(item))
106 return true; 106 return true;
107 return m_queue.Contains(item); 107 return m_queue.Contains(item);
@@ -111,12 +111,10 @@ namespace OpenSim.Framework
111 /// <summary> 111 /// <summary>
112 /// Return a count of the number of requests on this queue. 112 /// Return a count of the number of requests on this queue.
113 /// </summary> 113 /// </summary>
114 /// <remarks>
115 /// This method is not thread-safe. Do not rely on the result without consistent external locking.
116 /// </remarks>
117 public int Count() 114 public int Count()
118 { 115 {
119 return m_queue.Count + m_pqueue.Count; 116 lock (m_queueSync)
117 return m_queue.Count + m_pqueue.Count;
120 } 118 }
121 119
122 /// <summary> 120 /// <summary>
@@ -127,11 +125,11 @@ namespace OpenSim.Framework
127 /// </remarks> 125 /// </remarks>
128 public T[] GetQueueArray() 126 public T[] GetQueueArray()
129 { 127 {
130 if (m_queue.Count < 1 && m_pqueue.Count < 1)
131 return new T[0];
132
133 lock (m_queueSync) 128 lock (m_queueSync)
134 { 129 {
130 if (m_queue.Count < 1 && m_pqueue.Count < 1)
131 return new T[0];
132
135 return m_queue.ToArray(); 133 return m_queue.ToArray();
136 } 134 }
137 } 135 }