aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs36
1 files changed, 20 insertions, 16 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs
index 7b10713..fb20f40 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs
@@ -75,7 +75,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
75 /// Locking access to eventQueueThreads AND staticGlobalEventQueueThreads. 75 /// Locking access to eventQueueThreads AND staticGlobalEventQueueThreads.
76 /// Note that this may or may not be a reference to a static object depending on PrivateRegionThreads config setting. 76 /// Note that this may or may not be a reference to a static object depending on PrivateRegionThreads config setting.
77 /// </summary> 77 /// </summary>
78 private object eventQueueThreadsLock; 78 private object eventQueueThreadsLock = new object();
79 // Static objects for referencing the objects above if we don't have private threads: 79 // Static objects for referencing the objects above if we don't have private threads:
80 internal static List<EventQueueThreadClass> staticEventQueueThreads; // A static reference used if we don't use private threads 80 internal static List<EventQueueThreadClass> staticEventQueueThreads; // A static reference used if we don't use private threads
81 internal static object staticEventQueueThreadsLock; // Statick lock object reference for same reason 81 internal static object staticEventQueueThreadsLock; // Statick lock object reference for same reason
@@ -173,10 +173,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
173 { 173 {
174 m_ScriptEngine = _ScriptEngine; 174 m_ScriptEngine = _ScriptEngine;
175 175
176 bool PrivateRegionThreads = m_ScriptEngine.ScriptConfigSource.GetBoolean("PrivateRegionThreads", false);
176 177
177 // Create thread pool list and lock object 178 // Create thread pool list and lock object
178 // Determine from config if threads should be dedicated to regions or shared 179 // Determine from config if threads should be dedicated to regions or shared
179 if (m_ScriptEngine.ScriptConfigSource.GetBoolean("PrivateRegionThreads", false)) 180 if (PrivateRegionThreads)
180 { 181 {
181 // PRIVATE THREAD POOL PER REGION 182 // PRIVATE THREAD POOL PER REGION
182 eventQueueThreads = new List<EventQueueThreadClass>(); 183 eventQueueThreads = new List<EventQueueThreadClass>();
@@ -185,13 +186,13 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
185 else 186 else
186 { 187 {
187 // SHARED THREAD POOL 188 // SHARED THREAD POOL
188 // Crate the objects in statics 189 // Crate the static objects
189 if (staticEventQueueThreads == null) 190 if (staticEventQueueThreads == null)
190 staticEventQueueThreads = new List<EventQueueThreadClass>(); 191 staticEventQueueThreads = new List<EventQueueThreadClass>();
191 if (staticEventQueueThreadsLock == null) 192 if (staticEventQueueThreadsLock == null)
192 staticEventQueueThreadsLock = new object(); 193 staticEventQueueThreadsLock = new object();
193 194
194 // Create local reference to them 195 // Now reference our locals to them
195 eventQueueThreads = staticEventQueueThreads; 196 eventQueueThreads = staticEventQueueThreads;
196 eventQueueThreadsLock = staticEventQueueThreadsLock; 197 eventQueueThreadsLock = staticEventQueueThreadsLock;
197 } 198 }
@@ -228,22 +229,25 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
228 229
229 private void Stop() 230 private void Stop()
230 { 231 {
231 232 if (eventQueueThreadsLock != null && eventQueueThreads != null)
232 // Kill worker threads
233 lock (eventQueueThreadsLock)
234 { 233 {
235 foreach (EventQueueThreadClass EventQueueThread in eventQueueThreads) 234 // Kill worker threads
235 lock (eventQueueThreadsLock)
236 { 236 {
237 AbortThreadClass(EventQueueThread); 237 foreach (EventQueueThreadClass EventQueueThread in eventQueueThreads)
238 {
239 AbortThreadClass(EventQueueThread);
240 }
241 eventQueueThreads.Clear();
242 staticGlobalEventQueueThreads.Clear();
238 } 243 }
239 eventQueueThreads.Clear();
240 staticGlobalEventQueueThreads.Clear();
241 }
242 // Remove all entries from our event queue
243 lock (queueLock)
244 {
245 eventQueue.Clear();
246 } 244 }
245
246 // Remove all entries from our event queue
247 lock (queueLock)
248 {
249 eventQueue.Clear();
250 }
247 } 251 }
248 252
249 #endregion 253 #endregion