aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine
diff options
context:
space:
mode:
authorTedd Hansen2007-09-13 11:11:08 +0000
committerTedd Hansen2007-09-13 11:11:08 +0000
commitcef8c5e9d7ce49cc47e7ef1816465064d889d6d5 (patch)
treeeb50e06403d1270b5eb6ce1456e2c9d44b3c6488 /OpenSim/Region/ScriptEngine/DotNetEngine
parentBackup is now optional on classes (diff)
downloadopensim-SC_OLD-cef8c5e9d7ce49cc47e7ef1816465064d889d6d5.zip
opensim-SC_OLD-cef8c5e9d7ce49cc47e7ef1816465064d889d6d5.tar.gz
opensim-SC_OLD-cef8c5e9d7ce49cc47e7ef1816465064d889d6d5.tar.bz2
opensim-SC_OLD-cef8c5e9d7ce49cc47e7ef1816465064d889d6d5.tar.xz
Hiding evidence that I once was a VB coder (thanks to refactoring). Renamed member names to smallcapsy.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs44
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs32
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs72
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs30
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs58
10 files changed, 136 insertions, 136 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
index 14343b1..96670f1 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
@@ -15,11 +15,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
15{ 15{
16 public class AppDomainManager 16 public class AppDomainManager
17 { 17 {
18 private int MaxScriptsPerAppDomain = 1; 18 private int maxScriptsPerAppDomain = 1;
19 /// <summary> 19 /// <summary>
20 /// Internal list of all AppDomains 20 /// Internal list of all AppDomains
21 /// </summary> 21 /// </summary>
22 private List<AppDomainStructure> AppDomains = new List<AppDomainStructure>(); 22 private List<AppDomainStructure> appDomains = new List<AppDomainStructure>();
23 /// <summary> 23 /// <summary>
24 /// Structure to keep track of data around AppDomain 24 /// Structure to keep track of data around AppDomain
25 /// </summary> 25 /// </summary>
@@ -41,9 +41,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
41 /// <summary> 41 /// <summary>
42 /// Current AppDomain 42 /// Current AppDomain
43 /// </summary> 43 /// </summary>
44 private AppDomainStructure CurrentAD; 44 private AppDomainStructure currentAD;
45 private object GetLock = new object(); // Mutex 45 private object getLock = new object(); // Mutex
46 private object FreeLock = new object(); // Mutex 46 private object freeLock = new object(); // Mutex
47 47
48 //private ScriptEngine m_scriptEngine; 48 //private ScriptEngine m_scriptEngine;
49 //public AppDomainManager(ScriptEngine scriptEngine) 49 //public AppDomainManager(ScriptEngine scriptEngine)
@@ -59,25 +59,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
59 private AppDomainStructure GetFreeAppDomain() 59 private AppDomainStructure GetFreeAppDomain()
60 { 60 {
61 Console.WriteLine("Finding free AppDomain"); 61 Console.WriteLine("Finding free AppDomain");
62 lock (GetLock) 62 lock (getLock)
63 { 63 {
64 // Current full? 64 // Current full?
65 if (CurrentAD != null && CurrentAD.ScriptsLoaded >= MaxScriptsPerAppDomain) 65 if (currentAD != null && currentAD.ScriptsLoaded >= maxScriptsPerAppDomain)
66 { 66 {
67 // Add it to AppDomains list and empty current 67 // Add it to AppDomains list and empty current
68 AppDomains.Add(CurrentAD); 68 appDomains.Add(currentAD);
69 CurrentAD = null; 69 currentAD = null;
70 } 70 }
71 // No current 71 // No current
72 if (CurrentAD == null) 72 if (currentAD == null)
73 { 73 {
74 // Create a new current AppDomain 74 // Create a new current AppDomain
75 CurrentAD = new AppDomainStructure(); 75 currentAD = new AppDomainStructure();
76 CurrentAD.CurrentAppDomain = PrepareNewAppDomain(); 76 currentAD.CurrentAppDomain = PrepareNewAppDomain();
77 } 77 }
78 78
79 Console.WriteLine("Scripts loaded in this Appdomain: " + CurrentAD.ScriptsLoaded); 79 Console.WriteLine("Scripts loaded in this Appdomain: " + currentAD.ScriptsLoaded);
80 return CurrentAD; 80 return currentAD;
81 } // lock 81 } // lock
82 } 82 }
83 83
@@ -112,13 +112,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
112 /// </summary> 112 /// </summary>
113 private void UnloadAppDomains() 113 private void UnloadAppDomains()
114 { 114 {
115 lock (FreeLock) 115 lock (freeLock)
116 { 116 {
117 // Go through all 117 // Go through all
118 foreach (AppDomainStructure ads in new System.Collections.ArrayList(AppDomains)) 118 foreach (AppDomainStructure ads in new System.Collections.ArrayList(appDomains))
119 { 119 {
120 // Don't process current AppDomain 120 // Don't process current AppDomain
121 if (ads.CurrentAppDomain != CurrentAD.CurrentAppDomain) 121 if (ads.CurrentAppDomain != currentAD.CurrentAppDomain)
122 { 122 {
123 // Not current AppDomain 123 // Not current AppDomain
124 // Is number of unloaded bigger or equal to number of loaded? 124 // Is number of unloaded bigger or equal to number of loaded?
@@ -126,7 +126,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
126 { 126 {
127 Console.WriteLine("Found empty AppDomain, unloading"); 127 Console.WriteLine("Found empty AppDomain, unloading");
128 // Remove from internal list 128 // Remove from internal list
129 AppDomains.Remove(ads); 129 appDomains.Remove(ads);
130#if DEBUG 130#if DEBUG
131 long m = GC.GetTotalMemory(true); 131 long m = GC.GetTotalMemory(true);
132#endif 132#endif
@@ -164,19 +164,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
164 //[Obsolete("Needs fixing, needs a real purpose in life!!!")] 164 //[Obsolete("Needs fixing, needs a real purpose in life!!!")]
165 public void StopScript(AppDomain ad) 165 public void StopScript(AppDomain ad)
166 { 166 {
167 lock (FreeLock) 167 lock (freeLock)
168 { 168 {
169 Console.WriteLine("Stopping script in AppDomain"); 169 Console.WriteLine("Stopping script in AppDomain");
170 // Check if it is current AppDomain 170 // Check if it is current AppDomain
171 if (CurrentAD.CurrentAppDomain == ad) 171 if (currentAD.CurrentAppDomain == ad)
172 { 172 {
173 // Yes - increase 173 // Yes - increase
174 CurrentAD.ScriptsWaitingUnload++; 174 currentAD.ScriptsWaitingUnload++;
175 return; 175 return;
176 } 176 }
177 177
178 // Lopp through all AppDomains 178 // Lopp through all AppDomains
179 foreach (AppDomainStructure ads in new System.Collections.ArrayList(AppDomains)) 179 foreach (AppDomainStructure ads in new System.Collections.ArrayList(appDomains))
180 { 180 {
181 if (ads.CurrentAppDomain == ad) 181 if (ads.CurrentAppDomain == ad)
182 { 182 {
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs
index f5b40dc..5722d62 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs
@@ -34,7 +34,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
34{ 34{
35 public static class Common 35 public static class Common
36 { 36 {
37 static public bool Debug = true; 37 static public bool debug = true;
38 static public ScriptEngine mySE; 38 static public ScriptEngine mySE;
39 39
40 //public delegate void SendToDebugEventDelegate(string Message); 40 //public delegate void SendToDebugEventDelegate(string Message);
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
index 0cce317..a488b91 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
@@ -13,7 +13,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
13 { 13 {
14 private LSL2CSConverter LSL_Converter = new LSL2CSConverter(); 14 private LSL2CSConverter LSL_Converter = new LSL2CSConverter();
15 private CSharpCodeProvider codeProvider = new CSharpCodeProvider(); 15 private CSharpCodeProvider codeProvider = new CSharpCodeProvider();
16 private static UInt64 ScriptCompileCounter = 0; 16 private static UInt64 scriptCompileCounter = 0;
17 //private ICodeCompiler icc = codeProvider.CreateCompiler(); 17 //private ICodeCompiler icc = codeProvider.CreateCompiler();
18 public string CompileFromFile(string LSOFileName) 18 public string CompileFromFile(string LSOFileName)
19 { 19 {
@@ -49,8 +49,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
49 49
50 50
51 // Output assembly name 51 // Output assembly name
52 ScriptCompileCounter++; 52 scriptCompileCounter++;
53 string OutFile = Path.Combine("ScriptEngines", "Script_" + ScriptCompileCounter + ".dll"); 53 string OutFile = Path.Combine("ScriptEngines", "Script_" + scriptCompileCounter + ".dll");
54 try 54 try
55 { 55 {
56 System.IO.File.Delete(OutFile); 56 System.IO.File.Delete(OutFile);
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
index 9495888..3adb7e2 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
@@ -8,21 +8,21 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
8 public class LSL2CSConverter 8 public class LSL2CSConverter
9 { 9 {
10 //private Regex rnw = new Regex(@"[a-zA-Z0-9_\-]", RegexOptions.Compiled); 10 //private Regex rnw = new Regex(@"[a-zA-Z0-9_\-]", RegexOptions.Compiled);
11 private Dictionary<string, string> DataTypes = new Dictionary<string, string>(); 11 private Dictionary<string, string> dataTypes = new Dictionary<string, string>();
12 private Dictionary<string, string> QUOTES = new Dictionary<string, string>(); 12 private Dictionary<string, string> quotes = new Dictionary<string, string>();
13 13
14 public LSL2CSConverter() 14 public LSL2CSConverter()
15 { 15 {
16 // Only the types we need to convert 16 // Only the types we need to convert
17 DataTypes.Add("void", "void"); 17 dataTypes.Add("void", "void");
18 DataTypes.Add("integer", "int"); 18 dataTypes.Add("integer", "int");
19 DataTypes.Add("float", "double"); 19 dataTypes.Add("float", "double");
20 DataTypes.Add("string", "string"); 20 dataTypes.Add("string", "string");
21 DataTypes.Add("key", "string"); 21 dataTypes.Add("key", "string");
22 DataTypes.Add("vector", "LSL_Types.Vector3"); 22 dataTypes.Add("vector", "LSL_Types.Vector3");
23 DataTypes.Add("rotation", "LSL_Types.Quaternion"); 23 dataTypes.Add("rotation", "LSL_Types.Quaternion");
24 DataTypes.Add("list", "list"); 24 dataTypes.Add("list", "list");
25 DataTypes.Add("null", "null"); 25 dataTypes.Add("null", "null");
26 26
27 } 27 }
28 28
@@ -74,7 +74,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
74 _Script += quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]); 74 _Script += quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]);
75 } 75 }
76 // We just left a quote 76 // We just left a quote
77 QUOTES.Add(quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]), quote); 77 quotes.Add(quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]), quote);
78 quote = ""; 78 quote = "";
79 } 79 }
80 break; 80 break;
@@ -189,10 +189,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
189 189
190 190
191 191
192 foreach (string key in DataTypes.Keys) 192 foreach (string key in dataTypes.Keys)
193 { 193 {
194 string val; 194 string val;
195 DataTypes.TryGetValue(key, out val); 195 dataTypes.TryGetValue(key, out val);
196 196
197 // Replace CAST - (integer) with (int) 197 // Replace CAST - (integer) with (int)
198 Script = Regex.Replace(Script, @"\(" + key + @"\)", @"(" + val + ")", RegexOptions.Compiled | RegexOptions.Multiline); 198 Script = Regex.Replace(Script, @"\(" + key + @"\)", @"(" + val + ")", RegexOptions.Compiled | RegexOptions.Multiline);
@@ -217,10 +217,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
217 217
218 218
219 // REPLACE BACK QUOTES 219 // REPLACE BACK QUOTES
220 foreach (string key in QUOTES.Keys) 220 foreach (string key in quotes.Keys)
221 { 221 {
222 string val; 222 string val;
223 QUOTES.TryGetValue(key, out val); 223 quotes.TryGetValue(key, out val);
224 Script = Script.Replace(key, "\"" + val + "\""); 224 Script = Script.Replace(key, "\"" + val + "\"");
225 } 225 }
226 226
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
index bdab104..8f9f4e9 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
@@ -302,7 +302,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
302 public void llSetTimerEvent(double sec) 302 public void llSetTimerEvent(double sec)
303 { 303 {
304 // Setting timer repeat 304 // Setting timer repeat
305 m_ScriptEngine.myLSLLongCmdHandler.SetTimerEvent(m_localID, m_itemID, sec); 305 m_ScriptEngine.m_LSLLongCmdHandler.SetTimerEvent(m_localID, m_itemID, sec);
306 } 306 }
307 307
308 public void llSleep(double sec) 308 public void llSleep(double sec)
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
index 220aa1d..979865c 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
@@ -63,7 +63,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
63 // Add to queue for all scripts in ObjectID object 63 // Add to queue for all scripts in ObjectID object
64 //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start"); 64 //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start");
65 //Console.WriteLine("touch_start localID: " + localID); 65 //Console.WriteLine("touch_start localID: " + localID);
66 myScriptEngine.myEventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] { (int)1 }); 66 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] { (int)1 });
67 } 67 }
68 public void OnRezScript(uint localID, LLUUID itemID, string script) 68 public void OnRezScript(uint localID, LLUUID itemID, string script)
69 { 69 {
@@ -72,7 +72,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
72 // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost() 72 // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost()
73 //); 73 //);
74 Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + script.Length); 74 Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + script.Length);
75 myScriptEngine.myScriptManager.StartScript(localID, itemID, script); 75 myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script);
76 } 76 }
77 public void OnRemoveScript(uint localID, LLUUID itemID) 77 public void OnRemoveScript(uint localID, LLUUID itemID)
78 { 78 {
@@ -81,7 +81,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
81 // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost() 81 // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost()
82 //); 82 //);
83 Console.WriteLine("OnRemoveScript localID: " + localID + " LLUID: " + itemID.ToString()); 83 Console.WriteLine("OnRemoveScript localID: " + localID + " LLUID: " + itemID.ToString());
84 myScriptEngine.myScriptManager.StopScript( 84 myScriptEngine.m_ScriptManager.StopScript(
85 localID, 85 localID,
86 itemID 86 itemID
87 ); 87 );
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
index dde0a77..3dc5d77 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
@@ -47,20 +47,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
47 /// <summary> 47 /// <summary>
48 /// List of threads processing event queue 48 /// List of threads processing event queue
49 /// </summary> 49 /// </summary>
50 private List<Thread> EventQueueThreads = new List<Thread>(); 50 private List<Thread> eventQueueThreads = new List<Thread>();
51 private object QueueLock = new object(); // Mutex lock object 51 private object queueLock = new object(); // Mutex lock object
52 /// <summary> 52 /// <summary>
53 /// How many ms to sleep if queue is empty 53 /// How many ms to sleep if queue is empty
54 /// </summary> 54 /// </summary>
55 private int NothingToDoSleepms = 50; 55 private int nothingToDoSleepms = 50;
56 /// <summary> 56 /// <summary>
57 /// How many threads to process queue with 57 /// How many threads to process queue with
58 /// </summary> 58 /// </summary>
59 private int NumberOfThreads = 2; 59 private int numberOfThreads = 2;
60 /// <summary> 60 /// <summary>
61 /// Queue containing events waiting to be executed 61 /// Queue containing events waiting to be executed
62 /// </summary> 62 /// </summary>
63 private Queue<QueueItemStruct> EventQueue = new Queue<QueueItemStruct>(); 63 private Queue<QueueItemStruct> eventQueue = new Queue<QueueItemStruct>();
64 /// <summary> 64 /// <summary>
65 /// Queue item structure 65 /// Queue item structure
66 /// </summary> 66 /// </summary>
@@ -68,28 +68,28 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
68 { 68 {
69 public uint localID; 69 public uint localID;
70 public LLUUID itemID; 70 public LLUUID itemID;
71 public string FunctionName; 71 public string functionName;
72 public object[] param; 72 public object[] param;
73 } 73 }
74 74
75 /// <summary> 75 /// <summary>
76 /// List of localID locks for mutex processing of script events 76 /// List of localID locks for mutex processing of script events
77 /// </summary> 77 /// </summary>
78 private List<uint> ObjectLocks = new List<uint>(); 78 private List<uint> objectLocks = new List<uint>();
79 private object TryLockLock = new object(); // Mutex lock object 79 private object tryLockLock = new object(); // Mutex lock object
80 80
81 private ScriptEngine myScriptEngine; 81 private ScriptEngine m_ScriptEngine;
82 public EventQueueManager(ScriptEngine _ScriptEngine) 82 public EventQueueManager(ScriptEngine _ScriptEngine)
83 { 83 {
84 myScriptEngine = _ScriptEngine; 84 m_ScriptEngine = _ScriptEngine;
85 85
86 // 86 //
87 // Start event queue processing threads (worker threads) 87 // Start event queue processing threads (worker threads)
88 // 88 //
89 for (int ThreadCount = 0; ThreadCount <= NumberOfThreads; ThreadCount++) 89 for (int ThreadCount = 0; ThreadCount <= numberOfThreads; ThreadCount++)
90 { 90 {
91 Thread EventQueueThread = new Thread(EventQueueThreadLoop); 91 Thread EventQueueThread = new Thread(EventQueueThreadLoop);
92 EventQueueThreads.Add(EventQueueThread); 92 eventQueueThreads.Add(EventQueueThread);
93 EventQueueThread.IsBackground = true; 93 EventQueueThread.IsBackground = true;
94 EventQueueThread.Priority = ThreadPriority.BelowNormal; 94 EventQueueThread.Priority = ThreadPriority.BelowNormal;
95 EventQueueThread.Name = "EventQueueManagerThread_" + ThreadCount; 95 EventQueueThread.Name = "EventQueueManagerThread_" + ThreadCount;
@@ -100,7 +100,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
100 { 100 {
101 101
102 // Kill worker threads 102 // Kill worker threads
103 foreach (Thread EventQueueThread in new System.Collections.ArrayList(EventQueueThreads)) 103 foreach (Thread EventQueueThread in new System.Collections.ArrayList(eventQueueThreads))
104 { 104 {
105 if (EventQueueThread != null && EventQueueThread.IsAlive == true) 105 if (EventQueueThread != null && EventQueueThread.IsAlive == true)
106 { 106 {
@@ -115,9 +115,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
115 } 115 }
116 } 116 }
117 } 117 }
118 EventQueueThreads.Clear(); 118 eventQueueThreads.Clear();
119 // Todo: Clean up our queues 119 // Todo: Clean up our queues
120 EventQueue.Clear(); 120 eventQueue.Clear();
121 121
122 } 122 }
123 123
@@ -137,10 +137,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
137 QueueItemStruct QIS = BlankQIS; 137 QueueItemStruct QIS = BlankQIS;
138 bool GotItem = false; 138 bool GotItem = false;
139 139
140 if (EventQueue.Count == 0) 140 if (eventQueue.Count == 0)
141 { 141 {
142 // Nothing to do? Sleep a bit waiting for something to do 142 // Nothing to do? Sleep a bit waiting for something to do
143 Thread.Sleep(NothingToDoSleepms); 143 Thread.Sleep(nothingToDoSleepms);
144 } 144 }
145 else 145 else
146 { 146 {
@@ -148,19 +148,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
148 //myScriptEngine.m_logger.Verbose("ScriptEngine", "Processing event for localID: " + QIS.localID + ", itemID: " + QIS.itemID + ", FunctionName: " + QIS.FunctionName); 148 //myScriptEngine.m_logger.Verbose("ScriptEngine", "Processing event for localID: " + QIS.localID + ", itemID: " + QIS.itemID + ", FunctionName: " + QIS.FunctionName);
149 149
150 // OBJECT BASED LOCK - TWO THREADS WORKING ON SAME OBJECT IS NOT GOOD 150 // OBJECT BASED LOCK - TWO THREADS WORKING ON SAME OBJECT IS NOT GOOD
151 lock (QueueLock) 151 lock (queueLock)
152 { 152 {
153 GotItem = false; 153 GotItem = false;
154 for (int qc = 0; qc < EventQueue.Count; qc++) 154 for (int qc = 0; qc < eventQueue.Count; qc++)
155 { 155 {
156 // Get queue item 156 // Get queue item
157 QIS = EventQueue.Dequeue(); 157 QIS = eventQueue.Dequeue();
158 158
159 // Check if object is being processed by someone else 159 // Check if object is being processed by someone else
160 if (TryLock(QIS.localID) == false) 160 if (TryLock(QIS.localID) == false)
161 { 161 {
162 // Object is already being processed, requeue it 162 // Object is already being processed, requeue it
163 EventQueue.Enqueue(QIS); 163 eventQueue.Enqueue(QIS);
164 } 164 }
165 else 165 else
166 { 166 {
@@ -176,12 +176,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
176 // Execute function 176 // Execute function
177 try 177 try
178 { 178 {
179 myScriptEngine.myScriptManager.ExecuteEvent(QIS.localID, QIS.itemID, QIS.FunctionName, QIS.param); 179 m_ScriptEngine.m_ScriptManager.ExecuteEvent(QIS.localID, QIS.itemID, QIS.functionName, QIS.param);
180 } 180 }
181 catch (Exception e) 181 catch (Exception e)
182 { 182 {
183 // DISPLAY ERROR INWORLD 183 // DISPLAY ERROR INWORLD
184 string text = "Error executing script function \"" + QIS.FunctionName + "\":\r\n"; 184 string text = "Error executing script function \"" + QIS.functionName + "\":\r\n";
185 if (e.InnerException != null) 185 if (e.InnerException != null)
186 { // Send inner exception 186 { // Send inner exception
187 text += e.InnerException.Message.ToString(); 187 text += e.InnerException.Message.ToString();
@@ -194,10 +194,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
194 { 194 {
195 if (text.Length > 1500) 195 if (text.Length > 1500)
196 text = text.Substring(0, 1500); 196 text = text.Substring(0, 1500);
197 IScriptHost m_host = myScriptEngine.World.GetSceneObjectPart(QIS.localID); 197 IScriptHost m_host = m_ScriptEngine.World.GetSceneObjectPart(QIS.localID);
198 //if (m_host != null) 198 //if (m_host != null)
199 //{ 199 //{
200 myScriptEngine.World.SimChat(Helpers.StringToField(text), 1, m_host.AbsolutePosition, m_host.Name, m_host.UUID); 200 m_ScriptEngine.World.SimChat(Helpers.StringToField(text), 1, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
201 } catch { 201 } catch {
202 //} 202 //}
203 //else 203 //else
@@ -234,15 +234,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
234 /// <returns></returns> 234 /// <returns></returns>
235 private bool TryLock(uint localID) 235 private bool TryLock(uint localID)
236 { 236 {
237 lock (TryLockLock) 237 lock (tryLockLock)
238 { 238 {
239 if (ObjectLocks.Contains(localID) == true) 239 if (objectLocks.Contains(localID) == true)
240 { 240 {
241 return false; 241 return false;
242 } 242 }
243 else 243 else
244 { 244 {
245 ObjectLocks.Add(localID); 245 objectLocks.Add(localID);
246 return true; 246 return true;
247 } 247 }
248 } 248 }
@@ -254,11 +254,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
254 /// <param name="localID"></param> 254 /// <param name="localID"></param>
255 private void ReleaseLock(uint localID) 255 private void ReleaseLock(uint localID)
256 { 256 {
257 lock (TryLockLock) 257 lock (tryLockLock)
258 { 258 {
259 if (ObjectLocks.Contains(localID) == true) 259 if (objectLocks.Contains(localID) == true)
260 { 260 {
261 ObjectLocks.Remove(localID); 261 objectLocks.Remove(localID);
262 } 262 }
263 } 263 }
264 } 264 }
@@ -277,13 +277,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
277 277
278 278
279 // Do we have any scripts in this object at all? If not, return 279 // Do we have any scripts in this object at all? If not, return
280 if (myScriptEngine.myScriptManager.Scripts.ContainsKey(localID) == false) 280 if (m_ScriptEngine.m_ScriptManager.Scripts.ContainsKey(localID) == false)
281 { 281 {
282 //Console.WriteLine("Event \"" + FunctionName + "\" for localID: " + localID + ". No scripts found on this localID."); 282 //Console.WriteLine("Event \"" + FunctionName + "\" for localID: " + localID + ". No scripts found on this localID.");
283 return; 283 return;
284 } 284 }
285 285
286 Dictionary<LLUUID, LSL_BaseClass>.KeyCollection scriptKeys = myScriptEngine.myScriptManager.GetScriptKeys(localID); 286 Dictionary<LLUUID, LSL_BaseClass>.KeyCollection scriptKeys = m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID);
287 287
288 foreach ( LLUUID itemID in scriptKeys ) 288 foreach ( LLUUID itemID in scriptKeys )
289 { 289 {
@@ -303,17 +303,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
303 /// <param name="param">Array of parameters to match event mask</param> 303 /// <param name="param">Array of parameters to match event mask</param>
304 public void AddToScriptQueue(uint localID, LLUUID itemID, string FunctionName, object[] param) 304 public void AddToScriptQueue(uint localID, LLUUID itemID, string FunctionName, object[] param)
305 { 305 {
306 lock (QueueLock) 306 lock (queueLock)
307 { 307 {
308 // Create a structure and add data 308 // Create a structure and add data
309 QueueItemStruct QIS = new QueueItemStruct(); 309 QueueItemStruct QIS = new QueueItemStruct();
310 QIS.localID = localID; 310 QIS.localID = localID;
311 QIS.itemID = itemID; 311 QIS.itemID = itemID;
312 QIS.FunctionName = FunctionName; 312 QIS.functionName = FunctionName;
313 QIS.param = param; 313 QIS.param = param;
314 314
315 // Add it to queue 315 // Add it to queue
316 EventQueue.Enqueue(QIS); 316 eventQueue.Enqueue(QIS);
317 } 317 }
318 } 318 }
319 319
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
index 5ce972a..7ce6556 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
@@ -11,32 +11,32 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
11 /// </summary> 11 /// </summary>
12 class LSLLongCmdHandler 12 class LSLLongCmdHandler
13 { 13 {
14 private Thread CmdHandlerThread; 14 private Thread cmdHandlerThread;
15 private int CmdHandlerThreadCycleSleepms = 100; 15 private int cmdHandlerThreadCycleSleepms = 100;
16 16
17 private ScriptEngine myScriptEngine; 17 private ScriptEngine m_ScriptEngine;
18 public LSLLongCmdHandler(ScriptEngine _ScriptEngine) 18 public LSLLongCmdHandler(ScriptEngine _ScriptEngine)
19 { 19 {
20 myScriptEngine = _ScriptEngine; 20 m_ScriptEngine = _ScriptEngine;
21 21
22 // Start the thread that will be doing the work 22 // Start the thread that will be doing the work
23 CmdHandlerThread = new Thread(CmdHandlerThreadLoop); 23 cmdHandlerThread = new Thread(CmdHandlerThreadLoop);
24 CmdHandlerThread.Name = "CmdHandlerThread"; 24 cmdHandlerThread.Name = "CmdHandlerThread";
25 CmdHandlerThread.Priority = ThreadPriority.BelowNormal; 25 cmdHandlerThread.Priority = ThreadPriority.BelowNormal;
26 CmdHandlerThread.IsBackground = true; 26 cmdHandlerThread.IsBackground = true;
27 CmdHandlerThread.Start(); 27 cmdHandlerThread.Start();
28 } 28 }
29 ~LSLLongCmdHandler() 29 ~LSLLongCmdHandler()
30 { 30 {
31 // Shut down thread 31 // Shut down thread
32 try 32 try
33 { 33 {
34 if (CmdHandlerThread != null) 34 if (cmdHandlerThread != null)
35 { 35 {
36 if (CmdHandlerThread.IsAlive == true) 36 if (cmdHandlerThread.IsAlive == true)
37 { 37 {
38 CmdHandlerThread.Abort(); 38 cmdHandlerThread.Abort();
39 CmdHandlerThread.Join(); 39 cmdHandlerThread.Join();
40 } 40 }
41 } 41 }
42 } 42 }
@@ -51,7 +51,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
51 CheckTimerEvents(); 51 CheckTimerEvents();
52 52
53 // Sleep before next cycle 53 // Sleep before next cycle
54 Thread.Sleep(CmdHandlerThreadCycleSleepms); 54 Thread.Sleep(cmdHandlerThreadCycleSleepms);
55 } 55 }
56 } 56 }
57 57
@@ -134,7 +134,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
134 if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime()) 134 if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime())
135 { 135 {
136 // Add it to queue 136 // Add it to queue
137 myScriptEngine.myEventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", new object[] { }); 137 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", new object[] { });
138 // set next interval 138 // set next interval
139 139
140 140
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
index c743321..73cf851 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
@@ -45,11 +45,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
45 { 45 {
46 46
47 internal OpenSim.Region.Environment.Scenes.Scene World; 47 internal OpenSim.Region.Environment.Scenes.Scene World;
48 internal EventManager myEventManager; // Handles and queues incoming events from OpenSim 48 internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim
49 internal EventQueueManager myEventQueueManager; // Executes events 49 internal EventQueueManager m_EventQueueManager; // Executes events
50 internal ScriptManager myScriptManager; // Load, unload and execute scripts 50 internal ScriptManager m_ScriptManager; // Load, unload and execute scripts
51 internal AppDomainManager myAppDomainManager; 51 internal AppDomainManager m_AppDomainManager;
52 internal LSLLongCmdHandler myLSLLongCmdHandler; 52 internal LSLLongCmdHandler m_LSLLongCmdHandler;
53 53
54 private OpenSim.Framework.Console.LogBase m_log; 54 private OpenSim.Framework.Console.LogBase m_log;
55 55
@@ -75,11 +75,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
75 //m_logger.Status("ScriptEngine", "InitializeEngine"); 75 //m_logger.Status("ScriptEngine", "InitializeEngine");
76 76
77 // Create all objects we'll be using 77 // Create all objects we'll be using
78 myEventQueueManager = new EventQueueManager(this); 78 m_EventQueueManager = new EventQueueManager(this);
79 myEventManager = new EventManager(this); 79 m_EventManager = new EventManager(this);
80 myScriptManager = new ScriptManager(this); 80 m_ScriptManager = new ScriptManager(this);
81 myAppDomainManager = new AppDomainManager(); 81 m_AppDomainManager = new AppDomainManager();
82 myLSLLongCmdHandler = new LSLLongCmdHandler(this); 82 m_LSLLongCmdHandler = new LSLLongCmdHandler(this);
83 83
84 // Should we iterate the region for scripts that needs starting? 84 // Should we iterate the region for scripts that needs starting?
85 // Or can we assume we are loaded before anything else so we can use proper events? 85 // Or can we assume we are loaded before anything else so we can use proper events?
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