diff options
author | Homer Horwitz | 2008-09-27 18:29:17 +0000 |
---|---|---|
committer | Homer Horwitz | 2008-09-27 18:29:17 +0000 |
commit | 358bc41b034ff2c1e441a5535c9126247229e0c7 (patch) | |
tree | 897532690b78fe0e3c45a6417a14499ff8e54d4f | |
parent | Stop DNE saying "Loading script" when it's actually unloading. (diff) | |
download | opensim-SC-358bc41b034ff2c1e441a5535c9126247229e0c7.zip opensim-SC-358bc41b034ff2c1e441a5535c9126247229e0c7.tar.gz opensim-SC-358bc41b034ff2c1e441a5535c9126247229e0c7.tar.bz2 opensim-SC-358bc41b034ff2c1e441a5535c9126247229e0c7.tar.xz |
- adding Dequeue with a timeout to the BlockingQueue
-rw-r--r-- | OpenSim/Framework/BlockingQueue.cs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/OpenSim/Framework/BlockingQueue.cs b/OpenSim/Framework/BlockingQueue.cs index 586ccd7..6fbf88f 100644 --- a/OpenSim/Framework/BlockingQueue.cs +++ b/OpenSim/Framework/BlockingQueue.cs | |||
@@ -69,6 +69,23 @@ namespace OpenSim.Framework | |||
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | public T Dequeue(int msTimeout) | ||
73 | { | ||
74 | lock (m_queueSync) | ||
75 | { | ||
76 | if (m_queue.Count < 1 && m_pqueue.Count < 1) | ||
77 | { | ||
78 | Monitor.Wait(m_queueSync, msTimeout); | ||
79 | } | ||
80 | |||
81 | if (m_pqueue.Count > 0) | ||
82 | return m_pqueue.Dequeue(); | ||
83 | if (m_queue.Count > 0) | ||
84 | return m_queue.Dequeue(); | ||
85 | return default(T); | ||
86 | } | ||
87 | } | ||
88 | |||
72 | public bool Contains(T item) | 89 | public bool Contains(T item) |
73 | { | 90 | { |
74 | lock (m_queueSync) | 91 | lock (m_queueSync) |