aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs58
1 files changed, 29 insertions, 29 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index 5a7b5d3..055acc4 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -53,15 +53,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
53 public class ScriptManager 53 public class ScriptManager
54 { 54 {
55 #region Declares 55 #region Declares
56 private Thread ScriptLoadUnloadThread; 56 private Thread scriptLoadUnloadThread;
57 private int ScriptLoadUnloadThread_IdleSleepms = 100; 57 private int scriptLoadUnloadThread_IdleSleepms = 100;
58 private Queue<LoadStruct> LoadQueue = new Queue<LoadStruct>(); 58 private Queue<LoadStruct> loadQueue = new Queue<LoadStruct>();
59 private Queue<UnloadStruct> UnloadQueue = new Queue<UnloadStruct>(); 59 private Queue<UnloadStruct> unloadQueue = new Queue<UnloadStruct>();
60 private struct LoadStruct 60 private struct LoadStruct
61 { 61 {
62 public uint localID; 62 public uint localID;
63 public LLUUID itemID; 63 public LLUUID itemID;
64 public string Script; 64 public string script;
65 } 65 }
66 private struct UnloadStruct 66 private struct UnloadStruct
67 { 67 {
@@ -87,11 +87,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
87 { 87 {
88 m_scriptEngine = scriptEngine; 88 m_scriptEngine = scriptEngine;
89 AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); 89 AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
90 ScriptLoadUnloadThread = new Thread(ScriptLoadUnloadThreadLoop); 90 scriptLoadUnloadThread = new Thread(ScriptLoadUnloadThreadLoop);
91 ScriptLoadUnloadThread.Name = "ScriptLoadUnloadThread"; 91 scriptLoadUnloadThread.Name = "ScriptLoadUnloadThread";
92 ScriptLoadUnloadThread.IsBackground = true; 92 scriptLoadUnloadThread.IsBackground = true;
93 ScriptLoadUnloadThread.Priority = ThreadPriority.BelowNormal; 93 scriptLoadUnloadThread.Priority = ThreadPriority.BelowNormal;
94 ScriptLoadUnloadThread.Start(); 94 scriptLoadUnloadThread.Start();
95 95
96 } 96 }
97 ~ScriptManager () 97 ~ScriptManager ()
@@ -99,12 +99,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
99 // Abort load/unload thread 99 // Abort load/unload thread
100 try 100 try
101 { 101 {
102 if (ScriptLoadUnloadThread != null) 102 if (scriptLoadUnloadThread != null)
103 { 103 {
104 if (ScriptLoadUnloadThread.IsAlive == true) 104 if (scriptLoadUnloadThread.IsAlive == true)
105 { 105 {
106 ScriptLoadUnloadThread.Abort(); 106 scriptLoadUnloadThread.Abort();
107 ScriptLoadUnloadThread.Join(); 107 scriptLoadUnloadThread.Join();
108 } 108 }
109 } 109 }
110 } 110 }
@@ -120,18 +120,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
120 { 120 {
121 while (true) 121 while (true)
122 { 122 {
123 if (LoadQueue.Count == 0 && UnloadQueue.Count == 0) 123 if (loadQueue.Count == 0 && unloadQueue.Count == 0)
124 Thread.Sleep(ScriptLoadUnloadThread_IdleSleepms); 124 Thread.Sleep(scriptLoadUnloadThread_IdleSleepms);
125 125
126 if (LoadQueue.Count > 0) 126 if (loadQueue.Count > 0)
127 { 127 {
128 LoadStruct item = LoadQueue.Dequeue(); 128 LoadStruct item = loadQueue.Dequeue();
129 _StartScript(item.localID, item.itemID, item.Script); 129 _StartScript(item.localID, item.itemID, item.script);
130 } 130 }
131 131
132 if (UnloadQueue.Count > 0) 132 if (unloadQueue.Count > 0)
133 { 133 {
134 UnloadStruct item = UnloadQueue.Dequeue(); 134 UnloadStruct item = unloadQueue.Dequeue();
135 _StopScript(item.localID, item.itemID); 135 _StopScript(item.localID, item.itemID);
136 } 136 }
137 137
@@ -232,8 +232,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
232 LoadStruct ls = new LoadStruct(); 232 LoadStruct ls = new LoadStruct();
233 ls.localID = localID; 233 ls.localID = localID;
234 ls.itemID = itemID; 234 ls.itemID = itemID;
235 ls.Script = Script; 235 ls.script = Script;
236 LoadQueue.Enqueue(ls); 236 loadQueue.Enqueue(ls);
237 } 237 }
238 /// <summary> 238 /// <summary>
239 /// Disables and unloads a script 239 /// Disables and unloads a script
@@ -245,7 +245,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
245 UnloadStruct ls = new UnloadStruct(); 245 UnloadStruct ls = new UnloadStruct();
246 ls.localID = localID; 246 ls.localID = localID;
247 ls.itemID = itemID; 247 ls.itemID = itemID;
248 UnloadQueue.Enqueue(ls); 248 unloadQueue.Enqueue(ls);
249 } 249 }
250 250
251 private void _StartScript(uint localID, LLUUID itemID, string Script) 251 private void _StartScript(uint localID, LLUUID itemID, string Script)
@@ -279,7 +279,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
279 before = GC.GetTotalMemory(true); 279 before = GC.GetTotalMemory(true);
280#endif 280#endif
281 LSL_BaseClass CompiledScript; 281 LSL_BaseClass CompiledScript;
282 CompiledScript = m_scriptEngine.myAppDomainManager.LoadScript(FileName); 282 CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(FileName);
283#if DEBUG 283#if DEBUG
284 Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); 284 Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before);
285#endif 285#endif
@@ -297,7 +297,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
297 CompiledScript.Start(LSLB); 297 CompiledScript.Start(LSLB);
298 298
299 // Fire the first start-event 299 // Fire the first start-event
300 m_scriptEngine.myEventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] { }); 300 m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] { });
301 301
302 302
303 } 303 }
@@ -329,7 +329,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
329 329
330 330
331 // Stop long command on script 331 // Stop long command on script
332 m_scriptEngine.myLSLLongCmdHandler.RemoveScript(localID, itemID); 332 m_scriptEngine.m_LSLLongCmdHandler.RemoveScript(localID, itemID);
333 333
334 LSL_BaseClass LSLBC = GetScript(localID, itemID); 334 LSL_BaseClass LSLBC = GetScript(localID, itemID);
335 if (LSLBC == null) 335 if (LSLBC == null)
@@ -348,7 +348,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
348 // Remove from internal structure 348 // Remove from internal structure
349 RemoveScript(localID, itemID); 349 RemoveScript(localID, itemID);
350 // Tell AppDomain that we have stopped script 350 // Tell AppDomain that we have stopped script
351 m_scriptEngine.myAppDomainManager.StopScript(ad); 351 m_scriptEngine.m_AppDomainManager.StopScript(ad);
352 } 352 }
353 catch(Exception e) 353 catch(Exception e)
354 { 354 {
@@ -375,7 +375,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
375 375
376 // Execute a function in the script 376 // Execute a function in the script
377 //m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); 377 //m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName);
378 LSL_BaseClass Script = m_scriptEngine.myScriptManager.GetScript(localID, itemID); 378 LSL_BaseClass Script = m_scriptEngine.m_ScriptManager.GetScript(localID, itemID);
379 if (Script == null) 379 if (Script == null)
380 return; 380 return;
381 381