diff options
author | lbsa71 | 2008-01-02 09:07:11 +0000 |
---|---|---|
committer | lbsa71 | 2008-01-02 09:07:11 +0000 |
commit | 4b4ee9807054bdb06d7b1c3e0a5205836aff4f3c (patch) | |
tree | 1ba334b56be2a096875f57e84e76f5d5ee73575e /OpenSim/Framework/BlockingQueue.cs | |
parent | Put warning codes explaining why some explicit bin/ScriptEngines paths were a... (diff) | |
download | opensim-SC_OLD-4b4ee9807054bdb06d7b1c3e0a5205836aff4f3c.zip opensim-SC_OLD-4b4ee9807054bdb06d7b1c3e0a5205836aff4f3c.tar.gz opensim-SC_OLD-4b4ee9807054bdb06d7b1c3e0a5205836aff4f3c.tar.bz2 opensim-SC_OLD-4b4ee9807054bdb06d7b1c3e0a5205836aff4f3c.tar.xz |
* Trying to address TextureSender issues
* The BlockingQueue exposes Contains so we can make sure we don't add a TextureSender to the queue if there's already one present
* introduced some TryGetValue and various code convention stuff
Diffstat (limited to '')
-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 |