aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs81
1 files changed, 53 insertions, 28 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs
index fbdfff8..556593d 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs
@@ -41,28 +41,36 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
41 /// </summary> 41 /// </summary>
42 public class AsyncLSLCommandManager : iScriptEngineFunctionModule 42 public class AsyncLSLCommandManager : iScriptEngineFunctionModule
43 { 43 {
44 private Thread cmdHandlerThread; 44 private static Thread cmdHandlerThread;
45 private int cmdHandlerThreadCycleSleepms; 45 private int cmdHandlerThreadCycleSleepms;
46 46
47 private ScriptEngine m_ScriptEngine; 47 private ScriptEngine m_ScriptEngine;
48 48
49 public AsyncLSLCommandManager(ScriptEngine _ScriptEngine) 49 public AsyncLSLCommandManager()
50 { 50 {
51 m_ScriptEngine = _ScriptEngine; 51 //m_ScriptEngine = _ScriptEngine;
52 ReadConfig(); 52 ReadConfig();
53 53
54 // Start the thread that will be doing the work 54 StartThread();
55 cmdHandlerThread = new Thread(CmdHandlerThreadLoop); 55 }
56 cmdHandlerThread.Name = "CmdHandlerThread"; 56
57 cmdHandlerThread.Priority = ThreadPriority.BelowNormal; 57 private void StartThread()
58 cmdHandlerThread.IsBackground = true; 58 {
59 cmdHandlerThread.Start(); 59 if (cmdHandlerThread == null)
60 OpenSim.Framework.ThreadTracker.Add(cmdHandlerThread); 60 {
61 // Start the thread that will be doing the work
62 cmdHandlerThread = new Thread(CmdHandlerThreadLoop);
63 cmdHandlerThread.Name = "AsyncLSLCmdHandlerThread";
64 cmdHandlerThread.Priority = ThreadPriority.BelowNormal;
65 cmdHandlerThread.IsBackground = true;
66 cmdHandlerThread.Start();
67 OpenSim.Framework.ThreadTracker.Add(cmdHandlerThread);
68 }
61 } 69 }
62 70
63 public void ReadConfig() 71 public void ReadConfig()
64 { 72 {
65 cmdHandlerThreadCycleSleepms = m_ScriptEngine.ScriptConfigSource.GetInt("AsyncLLCommandLoopms", 50); 73 cmdHandlerThreadCycleSleepms = m_ScriptEngine.ScriptConfigSource.GetInt("AsyncLLCommandLoopms", 100);
66 } 74 }
67 75
68 ~AsyncLSLCommandManager() 76 ~AsyncLSLCommandManager()
@@ -88,29 +96,46 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
88 { 96 {
89 while (true) 97 while (true)
90 { 98 {
91 // Check timers 99 try
92 CheckTimerEvents(); 100 {
93 Thread.Sleep(25); 101 while (true)
94 // Check HttpRequests 102 {
95 CheckHttpRequests(); 103 Thread.Sleep(cmdHandlerThreadCycleSleepms);
96 Thread.Sleep(25); 104 lock (ScriptEngine.ScriptEngines)
97 // Check XMLRPCRequests 105 {
98 CheckXMLRPCRequests(); 106 foreach (ScriptEngine se in ScriptEngine.ScriptEngines)
99 Thread.Sleep(25); 107 {
100 // Check Listeners 108 m_ScriptEngine = se;
101 CheckListeners(); 109 m_ScriptEngine.m_ASYNCLSLCommandManager.DoOneCmdHandlerPass();
102 Thread.Sleep(25); 110 }
103 111 }
104 // Sleep before next cycle 112 // Sleep before next cycle
105 //Thread.Sleep(cmdHandlerThreadCycleSleepms); 113 //Thread.Sleep(cmdHandlerThreadCycleSleepms);
114 }
115 }
116 catch
117 {
118 }
106 } 119 }
107 } 120 }
108 121
122 internal void DoOneCmdHandlerPass()
123 {
124 // Check timers
125 CheckTimerEvents();
126 // Check HttpRequests
127 CheckHttpRequests();
128 // Check XMLRPCRequests
129 CheckXMLRPCRequests();
130 // Check Listeners
131 CheckListeners();
132 }
133
109 /// <summary> 134 /// <summary>
110 /// Remove a specific script (and all its pending commands) 135 /// Remove a specific script (and all its pending commands)
111 /// </summary> 136 /// </summary>
112 /// <param name="m_localID"></param> 137 /// <param name="localID"></param>
113 /// <param name="m_itemID"></param> 138 /// <param name="itemID"></param>
114 public void RemoveScript(uint localID, LLUUID itemID) 139 public void RemoveScript(uint localID, LLUUID itemID)
115 { 140 {
116 // Remove a specific script 141 // Remove a specific script