aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorubit2013-04-28 19:46:57 +0200
committerubit2013-04-28 19:46:57 +0200
commit7000b52aebcceb30163cf040a9d1b08e9bfd8412 (patch)
treee89cfcfec895c13fb6c7919580819700fa8815a3 /OpenSim/Framework
parentMerge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork (diff)
parentMake sharing errors not spew and let the cache retry the files (diff)
downloadopensim-SC_OLD-7000b52aebcceb30163cf040a9d1b08e9bfd8412.zip
opensim-SC_OLD-7000b52aebcceb30163cf040a9d1b08e9bfd8412.tar.gz
opensim-SC_OLD-7000b52aebcceb30163cf040a9d1b08e9bfd8412.tar.bz2
opensim-SC_OLD-7000b52aebcceb30163cf040a9d1b08e9bfd8412.tar.xz
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs5
-rw-r--r--OpenSim/Framework/Util.cs108
2 files changed, 110 insertions, 3 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 041fb94..ba6d87d 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -497,8 +497,6 @@ namespace OpenSim.Framework
497 /// </remarks> 497 /// </remarks>
498 public List<AvatarAttachment> GetAttachments() 498 public List<AvatarAttachment> GetAttachments()
499 { 499 {
500
501
502 lock (m_attachments) 500 lock (m_attachments)
503 { 501 {
504 List<AvatarAttachment> alist = new List<AvatarAttachment>(); 502 List<AvatarAttachment> alist = new List<AvatarAttachment>();
@@ -508,7 +506,8 @@ namespace OpenSim.Framework
508 alist.Add(new AvatarAttachment(attach)); 506 alist.Add(new AvatarAttachment(attach));
509 } 507 }
510 return alist; 508 return alist;
511 } } 509 }
510 }
512 511
513 internal void AppendAttachment(AvatarAttachment attach) 512 internal void AppendAttachment(AvatarAttachment attach)
514 { 513 {
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index e76a37b..48f3f8b 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -2097,4 +2097,112 @@ namespace OpenSim.Framework
2097 } 2097 }
2098 #endregion 2098 #endregion
2099 } 2099 }
2100
2101 public class DoubleQueue<T> where T:class
2102 {
2103 private Queue<T> m_lowQueue = new Queue<T>();
2104 private Queue<T> m_highQueue = new Queue<T>();
2105
2106 private object m_syncRoot = new object();
2107 private Semaphore m_s = new Semaphore(0, 1);
2108
2109 public DoubleQueue()
2110 {
2111 }
2112
2113 public virtual int Count
2114 {
2115 get { return m_highQueue.Count + m_lowQueue.Count; }
2116 }
2117
2118 public virtual void Enqueue(T data)
2119 {
2120 Enqueue(m_lowQueue, data);
2121 }
2122
2123 public virtual void EnqueueLow(T data)
2124 {
2125 Enqueue(m_lowQueue, data);
2126 }
2127
2128 public virtual void EnqueueHigh(T data)
2129 {
2130 Enqueue(m_highQueue, data);
2131 }
2132
2133 private void Enqueue(Queue<T> q, T data)
2134 {
2135 lock (m_syncRoot)
2136 {
2137 m_lowQueue.Enqueue(data);
2138 m_s.WaitOne(0);
2139 m_s.Release();
2140 }
2141 }
2142
2143 public virtual T Dequeue()
2144 {
2145 return Dequeue(Timeout.Infinite);
2146 }
2147
2148 public virtual T Dequeue(int tmo)
2149 {
2150 return Dequeue(TimeSpan.FromMilliseconds(tmo));
2151 }
2152
2153 public virtual T Dequeue(TimeSpan wait)
2154 {
2155 T res = null;
2156
2157 if (!Dequeue(wait, ref res))
2158 return null;
2159
2160 return res;
2161 }
2162
2163 public bool Dequeue(int timeout, ref T res)
2164 {
2165 return Dequeue(TimeSpan.FromMilliseconds(timeout), ref res);
2166 }
2167
2168 public bool Dequeue(TimeSpan wait, ref T res)
2169 {
2170 if (!m_s.WaitOne(wait))
2171 return false;
2172
2173 lock (m_syncRoot)
2174 {
2175 if (m_highQueue.Count > 0)
2176 res = m_highQueue.Dequeue();
2177 else
2178 res = m_lowQueue.Dequeue();
2179
2180 if (m_highQueue.Count == 0 && m_lowQueue.Count == 0)
2181 return true;
2182
2183 try
2184 {
2185 m_s.Release();
2186 }
2187 catch
2188 {
2189 }
2190
2191 return true;
2192 }
2193 }
2194
2195 public virtual void Clear()
2196 {
2197
2198 lock (m_syncRoot)
2199 {
2200 // Make sure sem count is 0
2201 m_s.WaitOne(0);
2202
2203 m_lowQueue.Clear();
2204 m_highQueue.Clear();
2205 }
2206 }
2207 }
2100} 2208}