aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2015-11-27 05:00:11 +0000
committerUbitUmarov2015-11-27 05:00:11 +0000
commitf16d36627f949a3568fea09dddcb76c9f8d823e6 (patch)
tree73c1bf3ecabcb2b1187f6eac18ce4aeb89367237
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
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs39
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs49
2 files changed, 44 insertions, 44 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
index b5a70040..f5b439b 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
@@ -57,8 +57,10 @@ namespace OpenSim.Region.ClientStack.Linden
57// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 57// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
58 58
59 private Scene m_scene; 59 private Scene m_scene;
60 private string m_SceneName = "";
60 private IAssetService m_AssetService; 61 private IAssetService m_AssetService;
61 private bool m_Enabled = true; 62 private bool m_Enabled = true;
63 private bool m_IsRunning = false;
62 private string m_URL; 64 private string m_URL;
63 65
64 private string m_URL2; 66 private string m_URL2;
@@ -87,7 +89,7 @@ namespace OpenSim.Region.ClientStack.Linden
87 private IAssetService m_assetService = null; 89 private IAssetService m_assetService = null;
88 90
89 private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); 91 private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
90 private static Thread[] m_workerThreads = null; 92 private Thread[] m_workerThreads = null;
91 93
92 private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue = 94 private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
93 new OpenMetaverse.BlockingQueue<aPollRequest>(); 95 new OpenMetaverse.BlockingQueue<aPollRequest>();
@@ -97,13 +99,6 @@ namespace OpenSim.Region.ClientStack.Linden
97 99
98 #region Region Module interfaceBase Members 100 #region Region Module interfaceBase Members
99 101
100 ~GetMeshModule()
101 {
102 foreach (Thread t in m_workerThreads)
103 Watchdog.AbortThread(t.ManagedThreadId);
104
105 }
106
107 public Type ReplaceableInterface 102 public Type ReplaceableInterface
108 { 103 {
109 get { return null; } 104 get { return null; }
@@ -167,6 +162,9 @@ namespace OpenSim.Region.ClientStack.Linden
167 m_scene.EventManager.OnDeregisterCaps += DeregisterCaps; 162 m_scene.EventManager.OnDeregisterCaps += DeregisterCaps;
168 m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate; 163 m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate;
169 164
165 m_IsRunning = true;
166 m_SceneName = m_scene.Name;
167
170 if (m_workerThreads == null) 168 if (m_workerThreads == null)
171 { 169 {
172 m_workerThreads = new Thread[2]; 170 m_workerThreads = new Thread[2];
@@ -174,7 +172,7 @@ namespace OpenSim.Region.ClientStack.Linden
174 for (uint i = 0; i < 2; i++) 172 for (uint i = 0; i < 2; i++)
175 { 173 {
176 m_workerThreads[i] = WorkManager.StartThread(DoMeshRequests, 174 m_workerThreads[i] = WorkManager.StartThread(DoMeshRequests,
177 String.Format("MeshWorkerThread{0}", i), 175 String.Format("GetMeshWorker[{0}]{1}",m_SceneName, i),
178 ThreadPriority.Normal, 176 ThreadPriority.Normal,
179 false, 177 false,
180 false, 178 false,
@@ -182,11 +180,19 @@ namespace OpenSim.Region.ClientStack.Linden
182 int.MaxValue); 180 int.MaxValue);
183 } 181 }
184 } 182 }
185
186 } 183 }
187 184
188 185 public void Close()
189 public void Close() { } 186 {
187 if(m_IsRunning && m_workerThreads != null)
188 {
189 m_log.DebugFormat("[GetMeshModule] Closing{0}", m_SceneName);
190 m_IsRunning = false;
191 foreach (Thread t in m_workerThreads)
192 Watchdog.AbortThread(t.ManagedThreadId);
193 }
194 m_queue.Clear();
195 }
190 196
191 public string Name { get { return "GetMeshModule"; } } 197 public string Name { get { return "GetMeshModule"; } }
192 198
@@ -194,10 +200,10 @@ namespace OpenSim.Region.ClientStack.Linden
194 200
195 private void DoMeshRequests() 201 private void DoMeshRequests()
196 { 202 {
197 while (true) 203 while (m_IsRunning)
198 { 204 {
199 aPollRequest poolreq = m_queue.Dequeue(); 205 aPollRequest poolreq = m_queue.Dequeue();
200 206 Watchdog.UpdateThread();
201 poolreq.thepoll.Process(poolreq); 207 poolreq.thepoll.Process(poolreq);
202 } 208 }
203 } 209 }
@@ -386,7 +392,7 @@ namespace OpenSim.Region.ClientStack.Linden
386 private volatile int BytesSent = 0; 392 private volatile int BytesSent = 0;
387 private int Lod3 = 0; 393 private int Lod3 = 0;
388 private int Lod2 = 0; 394 private int Lod2 = 0;
389 private int Lod1 = 0; 395// private int Lod1 = 0;
390 private int UserSetThrottle = 0; 396 private int UserSetThrottle = 0;
391 private int UDPSetThrottle = 0; 397 private int UDPSetThrottle = 0;
392 private int CapSetThrottle = 0; 398 private int CapSetThrottle = 0;
@@ -501,7 +507,7 @@ namespace OpenSim.Region.ClientStack.Linden
501 { 507 {
502 Lod3 = 0; 508 Lod3 = 0;
503 Lod2 = 0; 509 Lod2 = 0;
504 Lod1 = 0; 510// Lod1 = 0;
505 } 511 }
506 } 512 }
507 } 513 }
@@ -534,6 +540,5 @@ namespace OpenSim.Region.ClientStack.Linden
534 540
535 } 541 }
536 } 542 }
537
538 } 543 }
539} 544}
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}