diff options
Diffstat (limited to 'OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs')
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs index 5465035..bdfbe3d 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs | |||
@@ -3,15 +3,10 @@ | |||
3 | */ | 3 | */ |
4 | 4 | ||
5 | using System; | 5 | using System; |
6 | using System.Collections.Concurrent; | ||
6 | using System.Threading; | 7 | using System.Threading; |
7 | using System.Collections.Generic; | ||
8 | using System.IO; | ||
9 | using System.Reflection; | ||
10 | using System.Runtime.InteropServices; | ||
11 | using System.Text; | ||
12 | using OpenSim.Framework; | 8 | using OpenSim.Framework; |
13 | using OpenSim.Region.PhysicsModules.SharedBase; | 9 | using OpenSim.Region.PhysicsModules.SharedBase; |
14 | using OdeAPI; | ||
15 | using log4net; | 10 | using log4net; |
16 | using Nini.Config; | 11 | using Nini.Config; |
17 | using OpenMetaverse; | 12 | using OpenMetaverse; |
@@ -79,7 +74,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
79 | public float MeshSculptphysicalLOD = 32; | 74 | public float MeshSculptphysicalLOD = 32; |
80 | public float MinSizeToMeshmerize = 0.1f; | 75 | public float MinSizeToMeshmerize = 0.1f; |
81 | 76 | ||
82 | private OpenSim.Framework.BlockingQueue<ODEPhysRepData> workQueue = new OpenSim.Framework.BlockingQueue<ODEPhysRepData>(); | 77 | private BlockingCollection<ODEPhysRepData> workQueue = new BlockingCollection<ODEPhysRepData>(); |
83 | private bool m_running; | 78 | private bool m_running; |
84 | 79 | ||
85 | private Thread m_thread; | 80 | private Thread m_thread; |
@@ -106,10 +101,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
106 | private void DoWork() | 101 | private void DoWork() |
107 | { | 102 | { |
108 | m_mesher.ExpireFileCache(); | 103 | m_mesher.ExpireFileCache(); |
104 | ODEPhysRepData nextRep; | ||
109 | 105 | ||
110 | while(m_running) | 106 | while(m_running) |
111 | { | 107 | { |
112 | ODEPhysRepData nextRep = workQueue.Dequeue(); | 108 | workQueue.TryTake(out nextRep, -1); |
113 | if(!m_running) | 109 | if(!m_running) |
114 | return; | 110 | return; |
115 | if (nextRep == null) | 111 | if (nextRep == null) |
@@ -138,7 +134,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
138 | try | 134 | try |
139 | { | 135 | { |
140 | m_thread.Abort(); | 136 | m_thread.Abort(); |
141 | workQueue.Clear(); | 137 | // workQueue.Dispose(); |
142 | } | 138 | } |
143 | catch | 139 | catch |
144 | { | 140 | { |
@@ -195,7 +191,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
195 | repData.meshState = MeshState.loadingAsset; | 191 | repData.meshState = MeshState.loadingAsset; |
196 | 192 | ||
197 | repData.comand = meshWorkerCmnds.getmesh; | 193 | repData.comand = meshWorkerCmnds.getmesh; |
198 | workQueue.Enqueue(repData); | 194 | workQueue.Add(repData); |
199 | } | 195 | } |
200 | } | 196 | } |
201 | 197 | ||
@@ -241,7 +237,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
241 | if (needsMeshing(repData)) // no need for pbs now? | 237 | if (needsMeshing(repData)) // no need for pbs now? |
242 | { | 238 | { |
243 | repData.comand = meshWorkerCmnds.changefull; | 239 | repData.comand = meshWorkerCmnds.changefull; |
244 | workQueue.Enqueue(repData); | 240 | workQueue.Add(repData); |
245 | } | 241 | } |
246 | } | 242 | } |
247 | else | 243 | else |