diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs index 3777b67..67eefd9 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
30 | using System.IO; | 31 | using System.IO; |
31 | using Nini.Config; | 32 | using Nini.Config; |
32 | using OpenSim.Framework.Console; | 33 | using OpenSim.Framework.Console; |
@@ -46,13 +47,14 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
46 | { | 47 | { |
47 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
48 | 49 | ||
50 | public static List<ScriptEngine> ScriptEngines = new List<ScriptEngine>(); | ||
49 | public Scene World; | 51 | public Scene World; |
50 | public EventManager m_EventManager; // Handles and queues incoming events from OpenSim | 52 | public EventManager m_EventManager; // Handles and queues incoming events from OpenSim |
51 | public EventQueueManager m_EventQueueManager; // Executes events, handles script threads | 53 | public EventQueueManager m_EventQueueManager; // Executes events, handles script threads |
52 | public ScriptManager m_ScriptManager; // Load, unload and execute scripts | 54 | public ScriptManager m_ScriptManager; // Load, unload and execute scripts |
53 | public AppDomainManager m_AppDomainManager; // Handles loading/unloading of scripts into AppDomains | 55 | public AppDomainManager m_AppDomainManager; // Handles loading/unloading of scripts into AppDomains |
54 | public AsyncLSLCommandManager m_ASYNCLSLCommandManager; // Asyncronous LSL commands (commands that returns with an event) | 56 | public AsyncLSLCommandManager m_ASYNCLSLCommandManager; // Asyncronous LSL commands (commands that returns with an event) |
55 | public MaintenanceThread m_MaintenanceThread; // Thread that does different kinds of maintenance, for example refreshing config and killing scripts that has been running too long | 57 | public static MaintenanceThread m_MaintenanceThread; // Thread that does different kinds of maintenance, for example refreshing config and killing scripts that has been running too long |
56 | 58 | ||
57 | public IConfigSource ConfigSource; | 59 | public IConfigSource ConfigSource; |
58 | public IConfig ScriptConfigSource; | 60 | public IConfig ScriptConfigSource; |
@@ -74,15 +76,15 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
74 | 76 | ||
75 | public abstract ScriptManager _GetScriptManager(); | 77 | public abstract ScriptManager _GetScriptManager(); |
76 | 78 | ||
77 | public log4net.ILog Log | 79 | public static log4net.ILog Log |
78 | { | 80 | { |
79 | get { return m_log; } | 81 | get { return m_log; } |
80 | } | 82 | } |
81 | 83 | ||
82 | public ScriptEngine() | 84 | public ScriptEngine() |
83 | { | 85 | { |
84 | //Common.SendToDebug("ScriptEngine Object Initialized"); | 86 | Common.mySE = this; // For logging, just need any instance, doesn't matter |
85 | Common.mySE = this; | 87 | ScriptEngines.Add(this); // Keep a list of ScriptEngines for shared threads to process all instances |
86 | } | 88 | } |
87 | 89 | ||
88 | public void InitializeEngine(Scene Sceneworld, IConfigSource config, bool HookUpToServer, ScriptManager newScriptManager) | 90 | public void InitializeEngine(Scene Sceneworld, IConfigSource config, bool HookUpToServer, ScriptManager newScriptManager) |
@@ -106,7 +108,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
106 | m_ScriptManager = newScriptManager; | 108 | m_ScriptManager = newScriptManager; |
107 | m_AppDomainManager = new AppDomainManager(this); | 109 | m_AppDomainManager = new AppDomainManager(this); |
108 | m_ASYNCLSLCommandManager = new AsyncLSLCommandManager(this); | 110 | m_ASYNCLSLCommandManager = new AsyncLSLCommandManager(this); |
109 | m_MaintenanceThread = new MaintenanceThread(this); | 111 | if (m_MaintenanceThread == null) |
112 | m_MaintenanceThread = new MaintenanceThread(); | ||
110 | 113 | ||
111 | m_log.Info("[" + ScriptEngineName + "]: Reading configuration from config section \"" + ScriptEngineName + "\""); | 114 | m_log.Info("[" + ScriptEngineName + "]: Reading configuration from config section \"" + ScriptEngineName + "\""); |
112 | ReadConfig(); | 115 | ReadConfig(); |
@@ -118,6 +121,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
118 | public void Shutdown() | 121 | public void Shutdown() |
119 | { | 122 | { |
120 | // We are shutting down | 123 | // We are shutting down |
124 | ScriptEngines.Remove(this); | ||
121 | } | 125 | } |
122 | 126 | ||
123 | ScriptServerInterfaces.RemoteEvents ScriptServerInterfaces.ScriptEngine.EventManager() | 127 | ScriptServerInterfaces.RemoteEvents ScriptServerInterfaces.ScriptEngine.EventManager() |
@@ -178,12 +182,12 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
178 | /// <summary> | 182 | /// <summary> |
179 | /// If set to true then threads and stuff should try to make a graceful exit | 183 | /// If set to true then threads and stuff should try to make a graceful exit |
180 | /// </summary> | 184 | /// </summary> |
181 | public bool PleaseShutdown | 185 | //public bool PleaseShutdown |
182 | { | 186 | //{ |
183 | get { return _PleaseShutdown; } | 187 | // get { return _PleaseShutdown; } |
184 | set { _PleaseShutdown = value; } | 188 | // set { _PleaseShutdown = value; } |
185 | } | 189 | //} |
186 | private bool _PleaseShutdown = false; | 190 | //private bool _PleaseShutdown = false; |
187 | 191 | ||
188 | } | 192 | } |
189 | } | 193 | } |