aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/BlockingQueue.cs
diff options
context:
space:
mode:
authorMW2007-05-24 12:16:50 +0000
committerMW2007-05-24 12:16:50 +0000
commit3376b82501000692d6dac24b051af738cdaf2737 (patch)
tree90ed0a5d4955236f011fa63fce9d555186b0d179 /OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/BlockingQueue.cs
parentAdded "terrain save grdmap <filename> <gradientmap>" function to console. Gra... (diff)
downloadopensim-SC-3376b82501000692d6dac24b051af738cdaf2737.zip
opensim-SC-3376b82501000692d6dac24b051af738cdaf2737.tar.gz
opensim-SC-3376b82501000692d6dac24b051af738cdaf2737.tar.bz2
opensim-SC-3376b82501000692d6dac24b051af738cdaf2737.tar.xz
Some more code refactoring, plus a restructuring of the directories so that the Grid servers can be a separate solution to the region server.
Diffstat (limited to 'OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/BlockingQueue.cs')
-rw-r--r--OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/BlockingQueue.cs33
1 files changed, 33 insertions, 0 deletions
diff --git a/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/BlockingQueue.cs b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/BlockingQueue.cs
new file mode 100644
index 0000000..83685fc
--- /dev/null
+++ b/OpenGridServices-Source/OpenGridServices.Manager/OpenGridServices.Manager/BlockingQueue.cs
@@ -0,0 +1,33 @@
1using System;
2using System.Threading;
3using System.Collections.Generic;
4using System.Text;
5
6namespace OpenGridServices.Manager
7{
8 public class BlockingQueue<T>
9 {
10 private Queue<T> _queue = new Queue<T>();
11 private object _queueSync = new object();
12
13 public void Enqueue(T value)
14 {
15 lock (_queueSync)
16 {
17 _queue.Enqueue(value);
18 Monitor.Pulse(_queueSync);
19 }
20 }
21
22 public T Dequeue()
23 {
24 lock (_queueSync)
25 {
26 if (_queue.Count < 1)
27 Monitor.Wait(_queueSync);
28
29 return _queue.Dequeue();
30 }
31 }
32 }
33}