aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs36
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs11
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs3
3 files changed, 30 insertions, 20 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
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
index a6d1019..ea8ae1f 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
@@ -86,13 +86,18 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
86 get { return m_log; } 86 get { return m_log; }
87 } 87 }
88 88
89 public void InitializeEngine(Scene Sceneworld, LogBase logger, bool HookUpToServer, ScriptManager newScriptManager) 89 public void InitializeEngine(Scene Sceneworld, IConfigSource config, LogBase logger, bool HookUpToServer, ScriptManager newScriptManager)
90 { 90 {
91 World = Sceneworld; 91 World = Sceneworld;
92 m_log = logger; 92 m_log = logger;
93 ScriptConfigSource = ConfigSource.Configs[ScriptEngineName]; 93 ConfigSource = config;
94 Log.Verbose(ScriptEngineName, "ScriptEngine initializing");
95 Log.Verbose(ScriptEngineName, "Reading configuration from config section \"" + ScriptEngineName + "\"");
94 96
95 Log.Verbose(ScriptEngineName, "DotNet & LSL ScriptEngine initializing"); 97 // Make sure we have config
98 if (ConfigSource.Configs[ScriptEngineName] == null)
99 ConfigSource.AddConfig(ScriptEngineName);
100 ScriptConfigSource = ConfigSource.Configs[ScriptEngineName];
96 101
97 //m_logger.Status(ScriptEngineName, "InitializeEngine"); 102 //m_logger.Status(ScriptEngineName, "InitializeEngine");
98 103
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs b/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs
index ac3e8b7..38f7e7b 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs
@@ -27,6 +27,7 @@
27*/ 27*/
28 28
29using libsecondlife; 29using libsecondlife;
30using Nini.Config;
30using OpenSim.Framework; 31using OpenSim.Framework;
31using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
32using OpenSim.Region.Environment.Scenes; 33using OpenSim.Region.Environment.Scenes;
@@ -81,7 +82,7 @@ namespace OpenSim.Region.ScriptEngine.Common
81 public interface ScriptEngine 82 public interface ScriptEngine
82 { 83 {
83 RemoteEvents EventManager(); 84 RemoteEvents EventManager();
84 void InitializeEngine(Scene Sceneworld, LogBase logger, bool DontHookUp, ScriptManager newScriptManager); 85 void InitializeEngine(Scene Sceneworld, IConfigSource config, LogBase logger, bool DontHookUp, ScriptManager newScriptManager);
85 ScriptManager GetScriptManager(); 86 ScriptManager GetScriptManager();
86 } 87 }
87 88