diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | 39 |
1 files changed, 22 insertions, 17 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 | } |