aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-01-17 23:39:09 +0000
committerJustin Clark-Casey (justincc)2013-01-17 23:39:09 +0000
commitc8afc8523b9caf931afb3d5b3f9874b26b866a77 (patch)
treeb1a84d82591f462ae61b3aeed4f4b6dd3c5c06e8 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC-c8afc8523b9caf931afb3d5b3f9874b26b866a77.zip
opensim-SC-c8afc8523b9caf931afb3d5b3f9874b26b866a77.tar.gz
opensim-SC-c8afc8523b9caf931afb3d5b3f9874b26b866a77.tar.bz2
opensim-SC-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 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs12
1 files changed, 11 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index d47fd6b..cee10a8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -192,7 +192,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
192 { 192 {
193 if (m_coopSleepHandle == null) 193 if (m_coopSleepHandle == null)
194 System.Threading.Thread.Sleep(delay); 194 System.Threading.Thread.Sleep(delay);
195 else if (m_coopSleepHandle.WaitOne(delay)) 195 else
196 CheckForCoopTermination(delay);
197 }
198
199 /// <summary>
200 /// Check for co-operative termination.
201 /// </summary>
202 /// <param name='delay'>If called with 0, then just the check is performed with no wait.</param>
203 protected virtual void CheckForCoopTermination(int delay)
204 {
205 if (m_coopSleepHandle.WaitOne(delay))
196 throw new ScriptCoopStopException(); 206 throw new ScriptCoopStopException();
197 } 207 }
198 208