From 134f86e8d5c414409631b25b8c6f0ee45fbd8631 Mon Sep 17 00:00:00 2001
From: David Walter Seikel
Date: Thu, 3 Nov 2016 21:44:39 +1000
Subject: Initial update to OpenSim 0.8.2.1 source code.
---
OpenSim/Framework/BlockingQueue.cs | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Framework/BlockingQueue.cs')
diff --git a/OpenSim/Framework/BlockingQueue.cs b/OpenSim/Framework/BlockingQueue.cs
index 3658161..d11ad11 100644
--- a/OpenSim/Framework/BlockingQueue.cs
+++ b/OpenSim/Framework/BlockingQueue.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Framework
{
lock (m_queueSync)
{
- if (m_queue.Count < 1 && m_pqueue.Count < 1)
+ while (m_queue.Count < 1 && m_pqueue.Count < 1)
{
Monitor.Wait(m_queueSync);
}
@@ -76,9 +76,10 @@ namespace OpenSim.Framework
{
lock (m_queueSync)
{
- if (m_queue.Count < 1 && m_pqueue.Count < 1)
+ bool success = true;
+ while (m_queue.Count < 1 && m_pqueue.Count < 1 && success)
{
- Monitor.Wait(m_queueSync, msTimeout);
+ success = Monitor.Wait(m_queueSync, msTimeout);
}
if (m_pqueue.Count > 0)
@@ -89,28 +90,47 @@ namespace OpenSim.Framework
}
}
+ ///
+ /// Indicate whether this queue contains the given item.
+ ///
+ ///
+ /// This method is not thread-safe. Do not rely on the result without consistent external locking.
+ ///
public bool Contains(T item)
{
lock (m_queueSync)
{
+ if (m_queue.Count < 1 && m_pqueue.Count < 1)
+ return false;
+
if (m_pqueue.Contains(item))
return true;
return m_queue.Contains(item);
}
}
+ ///
+ /// Return a count of the number of requests on this queue.
+ ///
public int Count()
{
lock (m_queueSync)
- {
- return m_queue.Count+m_pqueue.Count;
- }
+ return m_queue.Count + m_pqueue.Count;
}
+ ///
+ /// Return the array of items on this queue.
+ ///
+ ///
+ /// This method is not thread-safe. Do not rely on the result without consistent external locking.
+ ///
public T[] GetQueueArray()
{
lock (m_queueSync)
{
+ if (m_queue.Count < 1 && m_pqueue.Count < 1)
+ return new T[0];
+
return m_queue.ToArray();
}
}
--
cgit v1.1