From c53f732163b391e4bcd33c8acb917deb7598e0a8 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 17 Aug 2015 21:46:30 +0200 Subject: Change the IScriptApi back to it's original form, removing XEngine specific additions that should not have been there in the first place. Sleeping and time measurement are now completely internal to XEngine --- .../ScriptEngine/Shared/Instance/ScriptInstance.cs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Instance') diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 8a744c3..fa6e6fc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -100,6 +100,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance public int DebugLevel { get; set; } + public WaitHandle CoopWaitHandle { get; private set; } + public Stopwatch ExecutionTimer { get; private set; } + public Dictionary, KeyValuePair> LineMap { get; set; } private Dictionary m_Apis = new Dictionary(); @@ -234,6 +237,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance { State = "default"; EventQueue = new Queue(32); + ExecutionTimer = new Stopwatch(); Engine = engine; Part = part; @@ -286,12 +290,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance m_stateSource = stateSource; m_coopTermination = coopTermination; + if (m_coopTermination) + CoopWaitHandle = coopSleepHandle; + else + CoopWaitHandle = null; + ApiManager am = new ApiManager(); foreach (string api in am.GetApis()) { m_Apis[api] = am.CreateApi(api); - m_Apis[api].Initialize(Engine, Part, ScriptTask, m_coopSleepHandle); + m_Apis[api].Initialize(Engine, Part, ScriptTask); } try @@ -766,8 +775,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance if (Suspended) return 0; - Stopwatch timer = new Stopwatch(); - timer.Start(); + ExecutionTimer.Restart(); try { @@ -775,9 +783,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance } finally { - timer.Stop(); - ExecutionTime.AddSample(timer); - Part.ParentGroup.Scene.AddScriptExecutionTime(timer.ElapsedTicks); + ExecutionTimer.Stop(); + ExecutionTime.AddSample(ExecutionTimer); + Part.ParentGroup.Scene.AddScriptExecutionTime(ExecutionTimer.ElapsedTicks); } } } -- cgit v1.1