minor: Add warning method doc about possibly inconsistent results returned from BlockingQueue.Contains(), Count() and GetQueueArray()

cpu-performance
Justin Clark-Casey (justincc) 2013-07-16 23:14:53 +01:00
parent 50b8ab60f2
commit cbc3576ee2
1 changed files with 19 additions and 1 deletions

View File

@ -89,6 +89,12 @@ namespace OpenSim.Framework
} }
} }
/// <summary>
/// Indicate whether this queue contains the given item.
/// </summary>
/// <remarks>
/// This method is not thread-safe. Do not rely on the result without consistent external locking.
/// </remarks>
public bool Contains(T item) public bool Contains(T item)
{ {
if (m_queue.Count < 1 && m_pqueue.Count < 1) if (m_queue.Count < 1 && m_pqueue.Count < 1)
@ -102,11 +108,23 @@ namespace OpenSim.Framework
} }
} }
/// <summary>
/// Return a count of the number of requests on this queue.
/// </summary>
/// <remarks>
/// This method is not thread-safe. Do not rely on the result without consistent external locking.
/// </remarks>
public int Count() public int Count()
{ {
return m_queue.Count+m_pqueue.Count; return m_queue.Count + m_pqueue.Count;
} }
/// <summary>
/// Return the array of items on this queue.
/// </summary>
/// <remarks>
/// This method is not thread-safe. Do not rely on the result without consistent external locking.
/// </remarks>
public T[] GetQueueArray() public T[] GetQueueArray()
{ {
if (m_queue.Count < 1 && m_pqueue.Count < 1) if (m_queue.Count < 1 && m_pqueue.Count < 1)