From 42bcd76b36621e590e3756526e9550aea7932b14 Mon Sep 17 00:00:00 2001 From: Tedd Hansen Date: Fri, 22 Feb 2008 16:15:08 +0000 Subject: Bugfixes - wasn't counting threads right++ --- .../Common/ScriptEngineBase/EventQueueManager.cs | 5 ++--- .../ScriptEngineBase/EventQueueThreadClass.cs | 5 +++-- .../Common/ScriptEngineBase/MaintenanceThread.cs | 24 +++++++++++----------- 3 files changed, 17 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs index 581c7a0..85b55f7 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs @@ -68,7 +68,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase /// List of threads (classes) processing event queue /// Note that this may or may not be a reference to a static object depending on PrivateRegionThreads config setting. /// - internal static List eventQueueThreads; // Thread pool that we work on + internal static List eventQueueThreads = new List(); // Thread pool that we work on /// /// Locking access to eventQueueThreads AND staticGlobalEventQueueThreads. /// @@ -131,7 +131,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase /// Queue containing events waiting to be executed /// public Queue eventQueue = new Queue(); - + #region " Queue structures " /// /// Queue item structure @@ -172,7 +172,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase { m_ScriptEngine = _ScriptEngine; - eventQueueThreads = new List(); ReadConfig(); } diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs index f36baa7..c0edcc4 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs @@ -27,6 +27,7 @@ */ using System; +using System.Collections; using System.Collections.Generic; using System.Text; using System.Threading; @@ -72,7 +73,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase public void ReadConfig() { - foreach (ScriptEngine m_ScriptEngine in ScriptEngine.ScriptEngines) + foreach (ScriptEngine m_ScriptEngine in new ArrayList(ScriptEngine.ScriptEngines)) { ScriptEngineName = m_ScriptEngine.ScriptEngineName; nothingToDoSleepms = m_ScriptEngine.ScriptConfigSource.GetInt("SleepTimeIfNoScriptExecutionMs", 50); @@ -186,7 +187,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase public void DoProcessQueue() { - foreach (ScriptEngine m_ScriptEngine in ScriptEngine.ScriptEngines) + foreach (ScriptEngine m_ScriptEngine in new ArrayList(ScriptEngine.ScriptEngines)) { lastScriptEngine = m_ScriptEngine; // Every now and then check if we should shut down diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs index af88183..0458a50 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs @@ -96,7 +96,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase #if DEBUG //m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: StopMaintenanceThread() called"); #endif - PleaseShutdown = true; + //PleaseShutdown = true; Thread.Sleep(100); try { @@ -130,8 +130,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase while (true) { System.Threading.Thread.Sleep(MaintenanceLoopms); // Sleep before next pass - if (PleaseShutdown) - return; + //if (PleaseShutdown) + // return; foreach (ScriptEngine m_ScriptEngine in new ArrayList(ScriptEngine.ScriptEngines)) { @@ -187,14 +187,14 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase } #endregion - /// - /// If set to true then threads and stuff should try to make a graceful exit - /// - public bool PleaseShutdown - { - get { return _PleaseShutdown; } - set { _PleaseShutdown = value; } - } - private bool _PleaseShutdown = false; + ///// + ///// If set to true then threads and stuff should try to make a graceful exit + ///// + //public bool PleaseShutdown + //{ + // get { return _PleaseShutdown; } + // set { _PleaseShutdown = value; } + //} + //private bool _PleaseShutdown = false; } } -- cgit v1.1