aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorTedd Hansen2008-02-02 00:09:55 +0000
committerTedd Hansen2008-02-02 00:09:55 +0000
commit34d21ac94b227e0ab7c089000751e746ccf004a8 (patch)
tree29ce90cb406c1bc31fe017ad880e32d7172501cb /OpenSim/Region/ScriptEngine
parentMoved iniFilePath to a static and put it in OpenSim.Application.iniFilePath. (diff)
downloadopensim-SC-34d21ac94b227e0ab7c089000751e746ccf004a8.zip
opensim-SC-34d21ac94b227e0ab7c089000751e746ccf004a8.tar.gz
opensim-SC-34d21ac94b227e0ab7c089000751e746ccf004a8.tar.bz2
opensim-SC-34d21ac94b227e0ab7c089000751e746ccf004a8.tar.xz
Added some error checking to MaintenanceThread, no-crash (just log) loading of script engines, and support to load multiple script engines
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs58
1 files changed, 31 insertions, 27 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs
index 105d47f..842bac9 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs
@@ -95,40 +95,44 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
95 System.Threading.Thread.Sleep(MaintenanceLoopms); // Sleep before next pass 95 System.Threading.Thread.Sleep(MaintenanceLoopms); // Sleep before next pass
96 if (PleaseShutdown) 96 if (PleaseShutdown)
97 return; 97 return;
98 // 98
99 // Re-reading config every x seconds 99 if (m_ScriptEngine != null)
100 //
101 if (m_ScriptEngine.RefreshConfigFileSeconds > 0)
102 { 100 {
103 // Check if its time to re-read config 101 //
104 if (DateTime.Now.Ticks - Last_ReReadConfigFilens > m_ScriptEngine.RefreshConfigFilens) 102 // Re-reading config every x seconds
103 //
104 if (m_ScriptEngine.RefreshConfigFileSeconds > 0)
105 { 105 {
106 // Its time to re-read config file 106 // Check if its time to re-read config
107 m_ScriptEngine.ConfigSource.Reload(); // Refresh config 107 if (DateTime.Now.Ticks - Last_ReReadConfigFilens > m_ScriptEngine.RefreshConfigFilens)
108 m_ScriptEngine.ReadConfig(); 108 {
109 Last_ReReadConfigFilens = DateTime.Now.Ticks; // Reset time 109 // Its time to re-read config file
110 m_ScriptEngine.ReadConfig();
111 Last_ReReadConfigFilens = DateTime.Now.Ticks; // Reset time
112 }
110 } 113 }
111 }
112 114
113 // 115 //
114 // Adjust number of running script threads if not correct 116 // Adjust number of running script threads if not correct
115 // 117 //
116 m_ScriptEngine.m_EventQueueManager.AdjustNumberOfScriptThreads(); 118 if (m_ScriptEngine.m_EventQueueManager != null)
119 m_ScriptEngine.m_EventQueueManager.AdjustNumberOfScriptThreads();
117 120
118 // 121 //
119 // Check if any script has exceeded its max execution time 122 // Check if any script has exceeded its max execution time
120 // 123 //
121 if (m_ScriptEngine.m_EventQueueManager.EnforceMaxExecutionTime) 124 if (m_ScriptEngine.m_EventQueueManager != null && m_ScriptEngine.m_EventQueueManager.EnforceMaxExecutionTime)
122 {
123 // We are enforcing execution time
124 if (DateTime.Now.Ticks - Last_maxFunctionExecutionTimens >
125 m_ScriptEngine.m_EventQueueManager.maxFunctionExecutionTimens)
126 { 125 {
127 // Its time to check again 126 // We are enforcing execution time
128 m_ScriptEngine.m_EventQueueManager.CheckScriptMaxExecTime(); // Do check 127 if (DateTime.Now.Ticks - Last_maxFunctionExecutionTimens >
129 Last_maxFunctionExecutionTimens = DateTime.Now.Ticks; // Reset time 128 m_ScriptEngine.m_EventQueueManager.maxFunctionExecutionTimens)
129 {
130 // Its time to check again
131 m_ScriptEngine.m_EventQueueManager.CheckScriptMaxExecTime(); // Do check
132 Last_maxFunctionExecutionTimens = DateTime.Now.Ticks; // Reset time
133 }
130 } 134 }
131 } 135 } // m_ScriptEngine != null
132 } 136 }
133 } 137 }
134 catch (Exception ex) 138 catch (Exception ex)