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.
This commit is contained in:
Justin Clark-Casey (justincc)
2013-01-17 23:39:09 +00:00
parent 9c99ed26eb
commit c8afc8523b
8 changed files with 307 additions and 77 deletions

View File

@@ -25,16 +25,17 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using log4net;
using System;
using OpenSim.Region.ScriptEngine.Shared;
using System.Reflection;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Interfaces;
using OpenMetaverse;
using Nini.Config;
using OpenSim.Region.ScriptEngine.Interfaces;
using OpenSim.Region.ScriptEngine.Shared;
using Amib.Threading;
using OpenSim.Framework;
using log4net;
using Nini.Config;
using OpenMetaverse;
namespace OpenSim.Region.ScriptEngine.Interfaces
{
@@ -76,6 +77,30 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
IConfigSource ConfigSource { get; }
string ScriptEngineName { get; }
string ScriptEnginePath { get; }
/// <summary>
/// Return the name of the base class that will be used for all running scripts.
/// </summary>
string ScriptBaseClassName { get; }
/// <summary>
/// Assemblies that need to be referenced when compiling scripts.
/// </summary>
/// <remarks>
/// These are currently additional to those always referenced by the compiler, BUT THIS MAY CHANGE IN THE
/// FUTURE.
/// This can be null if there are no additional assemblies.
/// </remarks>
string[] ScriptReferencedAssemblies { get; }
/// <summary>
/// Parameters for the generated script's constructor.
/// </summary>
/// <remarks>
/// Can be null if there are no parameters
/// </remarks>
ParameterInfo[] ScriptBaseClassParameters { get; }
IScriptApi GetApi(UUID itemID, string name);
}
}