diff options
Diffstat (limited to 'OpenSim/Framework/BlockingQueue.cs')
-rw-r--r-- | OpenSim/Framework/BlockingQueue.cs | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/OpenSim/Framework/BlockingQueue.cs b/OpenSim/Framework/BlockingQueue.cs index ae2a189..3ff3dac 100644 --- a/OpenSim/Framework/BlockingQueue.cs +++ b/OpenSim/Framework/BlockingQueue.cs | |||
@@ -32,27 +32,34 @@ namespace OpenSim.Framework | |||
32 | { | 32 | { |
33 | public class BlockingQueue<T> | 33 | public class BlockingQueue<T> |
34 | { | 34 | { |
35 | private Queue<T> _queue = new Queue<T>(); | 35 | private readonly Queue<T> m_queue = new Queue<T>(); |
36 | private object _queueSync = new object(); | 36 | private readonly object m_queueSync = new object(); |
37 | 37 | ||
38 | public void Enqueue(T value) | 38 | public void Enqueue(T value) |
39 | { | 39 | { |
40 | lock (_queueSync) | 40 | lock (m_queueSync) |
41 | { | 41 | { |
42 | _queue.Enqueue(value); | 42 | m_queue.Enqueue(value); |
43 | Monitor.Pulse(_queueSync); | 43 | Monitor.Pulse(m_queueSync); |
44 | } | 44 | } |
45 | } | 45 | } |
46 | 46 | ||
47 | public T Dequeue() | 47 | public T Dequeue() |
48 | { | 48 | { |
49 | lock (_queueSync) | 49 | lock (m_queueSync) |
50 | { | 50 | { |
51 | if (_queue.Count < 1) | 51 | if (m_queue.Count < 1) |
52 | Monitor.Wait(_queueSync); | 52 | { |
53 | Monitor.Wait(m_queueSync); | ||
54 | } | ||
53 | 55 | ||
54 | return _queue.Dequeue(); | 56 | return m_queue.Dequeue(); |
55 | } | 57 | } |
56 | } | 58 | } |
59 | |||
60 | public bool Contains(T item) | ||
61 | { | ||
62 | return m_queue.Contains(item); | ||
63 | } | ||
57 | } | 64 | } |
58 | } \ No newline at end of file | 65 | } \ No newline at end of file |