From 5ba99cbf554d965a6b11114a602c5317ca8f5ebd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 5 Dec 2012 23:33:48 +0000 Subject: Add IScriptInstance.EventsQueued to match EventsProcessed instead of asking callers to lock and directly inspect the EventQueue --- OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | 5 +++++ OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 9 +++++++++ OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 5 +---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs index f3abd96..0cef550 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs @@ -115,6 +115,11 @@ namespace OpenSim.Region.ScriptEngine.Interfaces Queue EventQueue { get; } /// + /// Number of events queued for processing. + /// + long EventsQueued { get; } + + /// /// Number of events processed by this script instance. /// long EventsProcessed { get; } diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 5bfe97a..8e81e9f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -173,6 +173,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance public Queue EventQueue { get; private set; } + public long EventsQueued + { + get + { + lock (EventQueue) + return EventQueue.Count; + } + } + public long EventsProcessed { get; private set; } public int StartParam { get; set; } diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 394826e..aeb807c 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -526,10 +526,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine sb.AppendFormat("Script name : {0}\n", instance.ScriptName); sb.AppendFormat("Status : {0}\n", status); - - lock (eq) - sb.AppendFormat("Queued events : {0}\n", eq.Count); - + sb.AppendFormat("Queued events : {0}\n", instance.EventsQueued); sb.AppendFormat("Processed events : {0}\n", instance.EventsProcessed); sb.AppendFormat("Item UUID : {0}\n", instance.ItemID); sb.AppendFormat("Containing part name: {0}\n", instance.PrimName); -- cgit v1.1