aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
diff options
context:
space:
mode:
authorUbitUmarov2015-11-27 05:00:11 +0000
committerUbitUmarov2015-11-27 05:00:11 +0000
commitf16d36627f949a3568fea09dddcb76c9f8d823e6 (patch)
tree73c1bf3ecabcb2b1187f6eac18ce4aeb89367237 /OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
parentFix Region Max height in boundingSize parameters checking in ArchiverModule.c... (diff)
downloadopensim-SC-f16d36627f949a3568fea09dddcb76c9f8d823e6.zip
opensim-SC-f16d36627f949a3568fea09dddcb76c9f8d823e6.tar.gz
opensim-SC-f16d36627f949a3568fea09dddcb76c9f8d823e6.tar.bz2
opensim-SC-f16d36627f949a3568fea09dddcb76c9f8d823e6.tar.xz
change threading on GetTexture and GetMesh NonSharable region modules
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs49
1 files changed, 22 insertions, 27 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
index aa51a00..81170b8 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
@@ -75,7 +75,7 @@ namespace OpenSim.Region.ClientStack.Linden
75 private IAssetService m_assetService = null; 75 private IAssetService m_assetService = null;
76 76
77 private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); 77 private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
78 private static Thread[] m_workerThreads = null; 78 private Thread[] m_workerThreads = null;
79 79
80 private string m_Url = "localhost"; 80 private string m_Url = "localhost";
81 81
@@ -84,7 +84,8 @@ namespace OpenSim.Region.ClientStack.Linden
84 84
85 private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>(); 85 private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>();
86 86
87 87 private bool m_IsRunning = false;
88 private string m_SceneName = "";
88 #region ISharedRegionModule Members 89 #region ISharedRegionModule Members
89 90
90 public void Initialise(IConfigSource source) 91 public void Initialise(IConfigSource source)
@@ -128,6 +129,9 @@ namespace OpenSim.Region.ClientStack.Linden
128 m_scene.EventManager.OnDeregisterCaps += DeregisterCaps; 129 m_scene.EventManager.OnDeregisterCaps += DeregisterCaps;
129 m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate; 130 m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate;
130 131
132 m_SceneName = m_scene.Name;
133 m_IsRunning = true;
134
131 if (m_workerThreads == null) 135 if (m_workerThreads == null)
132 { 136 {
133 m_workerThreads = new Thread[2]; 137 m_workerThreads = new Thread[2];
@@ -135,7 +139,7 @@ namespace OpenSim.Region.ClientStack.Linden
135 for (uint i = 0; i < 2; i++) 139 for (uint i = 0; i < 2; i++)
136 { 140 {
137 m_workerThreads[i] = WorkManager.StartThread(DoTextureRequests, 141 m_workerThreads[i] = WorkManager.StartThread(DoTextureRequests,
138 String.Format("TextureWorkerThread{0}", i), 142 String.Format("GetTextureWorker[{0}]{1}",m_SceneName, i),
139 ThreadPriority.Normal, 143 ThreadPriority.Normal,
140 false, 144 false,
141 false, 145 false,
@@ -165,17 +169,6 @@ namespace OpenSim.Region.ClientStack.Linden
165 adjData = pthrottles; 169 adjData = pthrottles;
166 } 170 }
167 171
168 // 0.125f converts from bits to bytes
169 //int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
170 //pos += 4;
171 // int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
172 //pos += 4;
173 // int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
174 // pos += 4;
175 // int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
176 // pos += 4;
177 // int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
178 // pos += 4;
179 pos = pos + 20; 172 pos = pos + 20;
180 int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); //pos += 4; 173 int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); //pos += 4;
181 //int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); 174 //int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
@@ -199,7 +192,17 @@ namespace OpenSim.Region.ClientStack.Linden
199 { 192 {
200 } 193 }
201 194
202 public void Close() { } 195 public void Close()
196 {
197 if(m_IsRunning && m_workerThreads != null)
198 {
199 m_log.DebugFormat("[GetTextureModule] Closing {0}", m_SceneName);
200 m_IsRunning = false;
201 foreach (Thread t in m_workerThreads)
202 Watchdog.AbortThread(t.ManagedThreadId);
203 }
204 m_queue.Clear();
205 }
203 206
204 public string Name { get { return "GetTextureModule"; } } 207 public string Name { get { return "GetTextureModule"; } }
205 208
@@ -210,13 +213,6 @@ namespace OpenSim.Region.ClientStack.Linden
210 213
211 #endregion 214 #endregion
212 215
213 ~GetTextureModule()
214 {
215 foreach (Thread t in m_workerThreads)
216 Watchdog.AbortThread(t.ManagedThreadId);
217
218 }
219
220 private class PollServiceTextureEventArgs : PollServiceEventArgs 216 private class PollServiceTextureEventArgs : PollServiceEventArgs
221 { 217 {
222 private List<Hashtable> requests = 218 private List<Hashtable> requests =
@@ -414,13 +410,14 @@ namespace OpenSim.Region.ClientStack.Linden
414 410
415 private void DoTextureRequests() 411 private void DoTextureRequests()
416 { 412 {
417 while (true) 413 while (m_IsRunning)
418 { 414 {
419 aPollRequest poolreq = m_queue.Dequeue(); 415 aPollRequest poolreq = m_queue.Dequeue();
420 416 Watchdog.UpdateThread();
421 poolreq.thepoll.Process(poolreq); 417 poolreq.thepoll.Process(poolreq);
422 } 418 }
423 } 419 }
420
424 internal sealed class CapsDataThrottler 421 internal sealed class CapsDataThrottler
425 { 422 {
426 423
@@ -498,7 +495,5 @@ namespace OpenSim.Region.ClientStack.Linden
498 } 495 }
499 public int ThrottleBytes; 496 public int ThrottleBytes;
500 } 497 }
501 } 498 }
502
503
504} 499}