diff options
Diffstat (limited to 'OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs')
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs index f4e2b1f..bdfbe3d 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs | |||
@@ -3,6 +3,7 @@ | |||
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 OpenSim.Framework; | 8 | using OpenSim.Framework; |
8 | using OpenSim.Region.PhysicsModules.SharedBase; | 9 | using OpenSim.Region.PhysicsModules.SharedBase; |
@@ -73,7 +74,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
73 | public float MeshSculptphysicalLOD = 32; | 74 | public float MeshSculptphysicalLOD = 32; |
74 | public float MinSizeToMeshmerize = 0.1f; | 75 | public float MinSizeToMeshmerize = 0.1f; |
75 | 76 | ||
76 | private OpenSim.Framework.BlockingQueue<ODEPhysRepData> workQueue = new OpenSim.Framework.BlockingQueue<ODEPhysRepData>(); | 77 | private BlockingCollection<ODEPhysRepData> workQueue = new BlockingCollection<ODEPhysRepData>(); |
77 | private bool m_running; | 78 | private bool m_running; |
78 | 79 | ||
79 | private Thread m_thread; | 80 | private Thread m_thread; |
@@ -100,10 +101,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
100 | private void DoWork() | 101 | private void DoWork() |
101 | { | 102 | { |
102 | m_mesher.ExpireFileCache(); | 103 | m_mesher.ExpireFileCache(); |
104 | ODEPhysRepData nextRep; | ||
103 | 105 | ||
104 | while(m_running) | 106 | while(m_running) |
105 | { | 107 | { |
106 | ODEPhysRepData nextRep = workQueue.Dequeue(); | 108 | workQueue.TryTake(out nextRep, -1); |
107 | if(!m_running) | 109 | if(!m_running) |
108 | return; | 110 | return; |
109 | if (nextRep == null) | 111 | if (nextRep == null) |
@@ -132,7 +134,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
132 | try | 134 | try |
133 | { | 135 | { |
134 | m_thread.Abort(); | 136 | m_thread.Abort(); |
135 | workQueue.Clear(); | 137 | // workQueue.Dispose(); |
136 | } | 138 | } |
137 | catch | 139 | catch |
138 | { | 140 | { |
@@ -189,7 +191,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
189 | repData.meshState = MeshState.loadingAsset; | 191 | repData.meshState = MeshState.loadingAsset; |
190 | 192 | ||
191 | repData.comand = meshWorkerCmnds.getmesh; | 193 | repData.comand = meshWorkerCmnds.getmesh; |
192 | workQueue.Enqueue(repData); | 194 | workQueue.Add(repData); |
193 | } | 195 | } |
194 | } | 196 | } |
195 | 197 | ||
@@ -235,7 +237,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
235 | if (needsMeshing(repData)) // no need for pbs now? | 237 | if (needsMeshing(repData)) // no need for pbs now? |
236 | { | 238 | { |
237 | repData.comand = meshWorkerCmnds.changefull; | 239 | repData.comand = meshWorkerCmnds.changefull; |
238 | workQueue.Enqueue(repData); | 240 | workQueue.Add(repData); |
239 | } | 241 | } |
240 | } | 242 | } |
241 | else | 243 | else |