diff options
author | Justin Clark-Casey (justincc) | 2013-01-17 23:39:09 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-01-17 23:39:09 +0000 |
commit | c8afc8523b9caf931afb3d5b3f9874b26b866a77 (patch) | |
tree | b1a84d82591f462ae61b3aeed4f4b6dd3c5c06e8 /OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC_OLD-c8afc8523b9caf931afb3d5b3f9874b26b866a77.zip opensim-SC_OLD-c8afc8523b9caf931afb3d5b3f9874b26b866a77.tar.gz opensim-SC_OLD-c8afc8523b9caf931afb3d5b3f9874b26b866a77.tar.bz2 opensim-SC_OLD-c8afc8523b9caf931afb3d5b3f9874b26b866a77.tar.xz |
Implement non-wait co-operative termination of scripts for XEngine in addition to termination on wait.
This involves inserting opensim_reserved_CheckForCoopTermination() calls in lsl -> c# translation at any place where the script could be in a loop with no wait calls.
These places are for, while, do-while, label, user function call and manual event function call.
Call goes through to an XEngineScriptBase which extends ScriptBase.
IEngine is extended to supply necessary engine-specific parent class references and constructor parameters to Compiler.
Unfortunately, since XEngineScriptBase has to be passed WaitHandle in its constructor, older compiled scripts will fail to load with an error on the OpenSim console.
Such scripts will need to be recompiled, either by removing all *.dll files from the bin/ScriptEngines/<region-id> or by setting DeleteScriptsOnStartup = true in [XEngine] for one run.
Automatic recompilation may be implemented in a later commit.
This feature should not yet be used, default remains termination with Thread.Abort() which will work as normal once scripts are recompiled.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index a17a018..8a02590 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -53,6 +53,7 @@ using OpenSim.Region.ScriptEngine.Shared.Instance; | |||
53 | using OpenSim.Region.ScriptEngine.Shared.Api; | 53 | using OpenSim.Region.ScriptEngine.Shared.Api; |
54 | using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; | 54 | using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; |
55 | using OpenSim.Region.ScriptEngine.Interfaces; | 55 | using OpenSim.Region.ScriptEngine.Interfaces; |
56 | using OpenSim.Region.ScriptEngine.XEngine.ScriptBase; | ||
56 | using Timer = OpenSim.Region.ScriptEngine.Shared.Api.Plugins.Timer; | 57 | using Timer = OpenSim.Region.ScriptEngine.Shared.Api.Plugins.Timer; |
57 | 58 | ||
58 | using ScriptCompileQueue = OpenSim.Framework.LocklessQueue<object[]>; | 59 | using ScriptCompileQueue = OpenSim.Framework.LocklessQueue<object[]>; |
@@ -176,6 +177,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
176 | get { return "XEngine"; } | 177 | get { return "XEngine"; } |
177 | } | 178 | } |
178 | 179 | ||
180 | public string ScriptBaseClassName { get; private set; } | ||
181 | |||
182 | public ParameterInfo[] ScriptBaseClassParameters { get; private set; } | ||
183 | |||
184 | public string[] ScriptReferencedAssemblies { get; private set; } | ||
185 | |||
179 | public Scene World | 186 | public Scene World |
180 | { | 187 | { |
181 | get { return m_Scene; } | 188 | get { return m_Scene; } |
@@ -230,6 +237,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
230 | 237 | ||
231 | m_ScriptConfig = configSource.Configs["XEngine"]; | 238 | m_ScriptConfig = configSource.Configs["XEngine"]; |
232 | m_ConfigSource = configSource; | 239 | m_ConfigSource = configSource; |
240 | |||
241 | ScriptBaseClassName = typeof(XEngineScriptBase).FullName; | ||
242 | ScriptBaseClassParameters = typeof(XEngineScriptBase).GetConstructor(new Type[] { typeof(WaitHandle) }).GetParameters(); | ||
243 | ScriptReferencedAssemblies = new string[] { Path.GetFileName(typeof(XEngineScriptBase).Assembly.Location) }; | ||
244 | |||
245 | Console.WriteLine("ASSEMBLY NAME: {0}", ScriptReferencedAssemblies[0]); | ||
233 | } | 246 | } |
234 | 247 | ||
235 | public void AddRegion(Scene scene) | 248 | public void AddRegion(Scene scene) |
@@ -1179,7 +1192,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1179 | } | 1192 | } |
1180 | catch (Exception e) | 1193 | catch (Exception e) |
1181 | { | 1194 | { |
1182 | // m_log.ErrorFormat("[XEngine]: Exception when rezzing script {0}{1}", e.Message, e.StackTrace); | 1195 | // m_log.ErrorFormat( |
1196 | // "[XEngine]: Exception when rezzing script with item ID {0}, {1}{2}", | ||
1197 | // itemID, e.Message, e.StackTrace); | ||
1183 | 1198 | ||
1184 | // try | 1199 | // try |
1185 | // { | 1200 | // { |