diff options
author | Tedd Hansen | 2008-02-02 00:59:22 +0000 |
---|---|---|
committer | Tedd Hansen | 2008-02-02 00:59:22 +0000 |
commit | 667197f24d1b9b050f1067f8a1fa757b7d46fdf6 (patch) | |
tree | a6e6cbcbcace7518f3591de30b9f46d6de9820ea /OpenSim/Region/ScriptEngine | |
parent | Thank you very much, Kinoc for : Moved the Listener loop try/catch to a bette... (diff) | |
download | opensim-SC_OLD-667197f24d1b9b050f1067f8a1fa757b7d46fdf6.zip opensim-SC_OLD-667197f24d1b9b050f1067f8a1fa757b7d46fdf6.tar.gz opensim-SC_OLD-667197f24d1b9b050f1067f8a1fa757b7d46fdf6.tar.bz2 opensim-SC_OLD-667197f24d1b9b050f1067f8a1fa757b7d46fdf6.tar.xz |
Added OpenSim.32BitLaunch.exe that can be used on 64-bit systems to run OpenSim in 32-bit mode.
Fixed ScriptEngine.Common startup problems.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
6 files changed, 40 insertions, 30 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 | ||
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | using Nini.Config; | ||
30 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
31 | using OpenSim.Framework.Console; | 32 | using OpenSim.Framework.Console; |
32 | using OpenSim.Region.Environment.Scenes; | 33 | using 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 | ||
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs index 5ba37f7..720f946 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs | |||
@@ -40,7 +40,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
40 | public override void Initialise(Scene scene, IConfigSource config) | 40 | public override void Initialise(Scene scene, IConfigSource config) |
41 | { | 41 | { |
42 | ConfigSource = config; | 42 | ConfigSource = config; |
43 | InitializeEngine(scene, MainLog.Instance, true, GetScriptManager()); | 43 | InitializeEngine(scene, config, MainLog.Instance, true, GetScriptManager()); |
44 | } | 44 | } |
45 | 45 | ||
46 | public override OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.ScriptManager _GetScriptManager() | 46 | public override OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.ScriptManager _GetScriptManager() |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 9cad388..8030a32 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | |||
@@ -41,7 +41,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
41 | : base(scriptEngine) | 41 | : base(scriptEngine) |
42 | { | 42 | { |
43 | base.m_scriptEngine = scriptEngine; | 43 | base.m_scriptEngine = scriptEngine; |
44 | |||
45 | } | 44 | } |
46 | 45 | ||
47 | // KEEP TRACK OF SCRIPTS <int id, whatever script> | 46 | // KEEP TRACK OF SCRIPTS <int id, whatever script> |
@@ -55,7 +54,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
55 | public override void _StartScript(uint localID, LLUUID itemID, string Script) | 54 | public override void _StartScript(uint localID, LLUUID itemID, string Script) |
56 | { | 55 | { |
57 | //IScriptHost root = host.GetRoot(); | 56 | //IScriptHost root = host.GetRoot(); |
58 | Console.WriteLine("ScriptManager StartScript: localID: " + localID + ", itemID: " + itemID); | 57 | m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "ScriptManager StartScript: localID: " + localID + ", itemID: " + itemID); |
59 | 58 | ||
60 | // We will initialize and start the script. | 59 | // We will initialize and start the script. |
61 | // It will be up to the script itself to hook up the correct events. | 60 | // It will be up to the script itself to hook up the correct events. |
@@ -77,7 +76,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
77 | CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource); | 76 | CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource); |
78 | 77 | ||
79 | #if DEBUG | 78 | #if DEBUG |
80 | Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); | 79 | m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); |
81 | #endif | 80 | #endif |
82 | 81 | ||
83 | CompiledScript.Source = Script; | 82 | CompiledScript.Source = Script; |
@@ -110,8 +109,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
110 | } | 109 | } |
111 | catch (Exception e2) | 110 | catch (Exception e2) |
112 | { | 111 | { |
113 | m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString()); | 112 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Error displaying error in-world: " + e2.ToString()); |
114 | m_scriptEngine.Log.Error("ScriptEngine", | 113 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, |
115 | "Errormessage: Error compiling script:\r\n" + e.Message.ToString()); | 114 | "Errormessage: Error compiling script:\r\n" + e.Message.ToString()); |
116 | } | 115 | } |
117 | } | 116 | } |
@@ -120,8 +119,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
120 | public override void _StopScript(uint localID, LLUUID itemID) | 119 | public override void _StopScript(uint localID, LLUUID itemID) |
121 | { | 120 | { |
122 | // Stop script | 121 | // Stop script |
123 | Console.WriteLine("Stop script localID: " + localID + " LLUID: " + itemID.ToString()); | 122 | #if DEBUG |
124 | 123 | m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Stop script localID: " + localID + " LLUID: " + itemID.ToString()); | |
124 | #endif | ||
125 | 125 | ||
126 | // Stop long command on script | 126 | // Stop long command on script |
127 | m_scriptEngine.m_ASYNCLSLCommandManager.RemoveScript(localID, itemID); | 127 | m_scriptEngine.m_ASYNCLSLCommandManager.RemoveScript(localID, itemID); |
@@ -147,7 +147,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
147 | } | 147 | } |
148 | catch (Exception e) | 148 | catch (Exception e) |
149 | { | 149 | { |
150 | Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() + | 150 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() + |
151 | ": " + e.ToString()); | 151 | ": " + e.ToString()); |
152 | } | 152 | } |
153 | } | 153 | } |
diff --git a/OpenSim/Region/ScriptEngine/LSOEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/LSOEngine/ScriptEngine.cs index 49727c2..45dfd9e 100644 --- a/OpenSim/Region/ScriptEngine/LSOEngine/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/LSOEngine/ScriptEngine.cs | |||
@@ -44,7 +44,7 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine | |||
44 | // We need to override a few things for our DotNetEngine | 44 | // We need to override a few things for our DotNetEngine |
45 | public override void Initialise(Scene scene, IConfigSource config) | 45 | public override void Initialise(Scene scene, IConfigSource config) |
46 | { | 46 | { |
47 | InitializeEngine(scene, MainLog.Instance, true, GetScriptManager()); | 47 | InitializeEngine(scene, config, MainLog.Instance, true, GetScriptManager()); |
48 | } | 48 | } |
49 | 49 | ||
50 | public override OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.ScriptManager _GetScriptManager() | 50 | public override OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.ScriptManager _GetScriptManager() |