- adding Dequeue with a timeout to the BlockingQueue

0.6.0-stable
Homer Horwitz 2008-09-27 18:29:17 +00:00
parent c0b60bb8cf
commit 358bc41b03
1 changed files with 17 additions and 0 deletions

View File

@ -69,6 +69,23 @@ namespace OpenSim.Framework
}
}
public T Dequeue(int msTimeout)
{
lock (m_queueSync)
{
if (m_queue.Count < 1 && m_pqueue.Count < 1)
{
Monitor.Wait(m_queueSync, msTimeout);
}
if (m_pqueue.Count > 0)
return m_pqueue.Dequeue();
if (m_queue.Count > 0)
return m_queue.Dequeue();
return default(T);
}
}
public bool Contains(T item)
{
lock (m_queueSync)