From 46cfc475aa53fd7e7eee270f4dea4bd25c75c050 Mon Sep 17 00:00:00 2001 From: Tedd Hansen Date: Fri, 22 Feb 2008 22:53:19 +0000 Subject: [PATCH] ScriptEngine works again (startup-nully-error gone) --- .../AsyncLSLCommandManager.cs | 19 +++++++++---------- .../ScriptEngineBase/EventQueueThreadClass.cs | 8 ++++---- .../ScriptEngineBase/MaintenanceThread.cs | 8 ++++---- .../Common/ScriptEngineBase/ScriptEngine.cs | 2 +- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs index 556593dc4f..33c651102a 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs @@ -42,13 +42,13 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase public class AsyncLSLCommandManager : iScriptEngineFunctionModule { private static Thread cmdHandlerThread; - private int cmdHandlerThreadCycleSleepms; + private static int cmdHandlerThreadCycleSleepms; private ScriptEngine m_ScriptEngine; - public AsyncLSLCommandManager() + public AsyncLSLCommandManager(ScriptEngine _ScriptEngine) { - //m_ScriptEngine = _ScriptEngine; + m_ScriptEngine = _ScriptEngine; ReadConfig(); StartThread(); @@ -92,7 +92,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase } } - private void CmdHandlerThreadLoop() + private static void CmdHandlerThreadLoop() { while (true) { @@ -101,14 +101,13 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase while (true) { Thread.Sleep(cmdHandlerThreadCycleSleepms); - lock (ScriptEngine.ScriptEngines) - { - foreach (ScriptEngine se in ScriptEngine.ScriptEngines) + //lock (ScriptEngine.ScriptEngines) + //{ + foreach (ScriptEngine se in new ArrayList(ScriptEngine.ScriptEngines)) { - m_ScriptEngine = se; - m_ScriptEngine.m_ASYNCLSLCommandManager.DoOneCmdHandlerPass(); + se.m_ASYNCLSLCommandManager.DoOneCmdHandlerPass(); } - } + //} // Sleep before next cycle //Thread.Sleep(cmdHandlerThreadCycleSleepms); } diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs index a70e93b00a..caf043d9e0 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs @@ -73,9 +73,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase public void ReadConfig() { - //lock (ScriptEngine.ScriptEngines) - //{ - foreach (ScriptEngine m_ScriptEngine in new ArrayList(ScriptEngine.ScriptEngines)) + lock (ScriptEngine.ScriptEngines) + { + foreach (ScriptEngine m_ScriptEngine in ScriptEngine.ScriptEngines) { ScriptEngineName = m_ScriptEngine.ScriptEngineName; nothingToDoSleepms = m_ScriptEngine.ScriptConfigSource.GetInt("SleepTimeIfNoScriptExecutionMs", 50); @@ -106,7 +106,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase break; } } - //} + } // Now set that priority if (EventQueueThread != null) if (EventQueueThread.IsAlive) diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs index eb57a9e45a..0fcabab723 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs @@ -164,9 +164,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase MaintenanceLoopTicks_Other_Count++; - lock (ScriptEngine.ScriptEngines) - { - foreach (ScriptEngine m_ScriptEngine in ScriptEngine.ScriptEngines) + //lock (ScriptEngine.ScriptEngines) + //{ + foreach (ScriptEngine m_ScriptEngine in new ArrayList(ScriptEngine.ScriptEngines)) { lastScriptEngine = m_ScriptEngine; // Re-reading config every x seconds @@ -212,7 +212,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase m_ScriptEngine.m_ScriptManager.DoScriptLoadUnload(); } } - } + //} } } catch (Exception ex) diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs index b861ad50c7..ac115e9da5 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs @@ -110,7 +110,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase newScriptManager.Start(); m_ScriptManager = newScriptManager; m_AppDomainManager = new AppDomainManager(this); - m_ASYNCLSLCommandManager = new AsyncLSLCommandManager(); + m_ASYNCLSLCommandManager = new AsyncLSLCommandManager(this); if (m_MaintenanceThread == null) m_MaintenanceThread = new MaintenanceThread();