diff options
author | Tedd Hansen | 2007-08-25 19:08:15 +0000 |
---|---|---|
committer | Tedd Hansen | 2007-08-25 19:08:15 +0000 |
commit | b75c1b2191640f4a140dc4cd0e8ce35ab64863d9 (patch) | |
tree | 05a5194e8e304df86897003bdbceca68fd65fd80 /OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs | |
parent | Scripts no longer crash sim after 5 minutes (override InitializeLifetimeServi... (diff) | |
download | opensim-SC_OLD-b75c1b2191640f4a140dc4cd0e8ce35ab64863d9.zip opensim-SC_OLD-b75c1b2191640f4a140dc4cd0e8ce35ab64863d9.tar.gz opensim-SC_OLD-b75c1b2191640f4a140dc4cd0e8ce35ab64863d9.tar.bz2 opensim-SC_OLD-b75c1b2191640f4a140dc4cd0e8ce35ab64863d9.tar.xz |
Added class for "long commands" (command that returns as event) with dedicated thread for processing. Added support for llSetTimerEvent(). Deleting old compiled scripts before new compile is attempted (avoids loading wrong script on compile error).
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs index 1cab01e..c62e862 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs | |||
@@ -226,6 +226,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
226 | } | 226 | } |
227 | } | 227 | } |
228 | 228 | ||
229 | |||
229 | /// <summary> | 230 | /// <summary> |
230 | /// Add event to event execution queue | 231 | /// Add event to event execution queue |
231 | /// </summary> | 232 | /// </summary> |
@@ -237,34 +238,44 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
237 | // Determine all scripts in Object and add to their queue | 238 | // Determine all scripts in Object and add to their queue |
238 | //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventQueueManager Adding localID: " + localID + ", FunctionName: " + FunctionName); | 239 | //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventQueueManager Adding localID: " + localID + ", FunctionName: " + FunctionName); |
239 | 240 | ||
240 | lock (QueueLock) | ||
241 | { | ||
242 | 241 | ||
243 | // Do we have any scripts in this object at all? If not, return | 242 | // Do we have any scripts in this object at all? If not, return |
244 | if (myScriptEngine.myScriptManager.Scripts.ContainsKey(localID) == false) | 243 | if (myScriptEngine.myScriptManager.Scripts.ContainsKey(localID) == false) |
245 | { | 244 | { |
246 | //Console.WriteLine("Event \"" + FunctionName + "\" for localID: " + localID + ". No scripts found on this localID."); | 245 | //Console.WriteLine("Event \"" + FunctionName + "\" for localID: " + localID + ". No scripts found on this localID."); |
247 | return; | 246 | return; |
248 | } | 247 | } |
249 | 248 | ||
250 | foreach (LLUUID itemID in myScriptEngine.myScriptManager.GetScriptKeys(localID)) | 249 | foreach (LLUUID itemID in new System.Collections.ArrayList(myScriptEngine.myScriptManager.GetScriptKeys(localID))) |
251 | { | 250 | { |
252 | // Add to each script in that object | 251 | // Add to each script in that object |
253 | // TODO: Some scripts may not subscribe to this event. Should we NOT add it? Does it matter? | 252 | // TODO: Some scripts may not subscribe to this event. Should we NOT add it? Does it matter? |
253 | AddToScriptQueue(localID, itemID, FunctionName, param); | ||
254 | } | ||
254 | 255 | ||
255 | // Create a structure and add data | 256 | } |
256 | QueueItemStruct QIS = new QueueItemStruct(); | ||
257 | QIS.localID = localID; | ||
258 | QIS.itemID = itemID; | ||
259 | QIS.FunctionName = FunctionName; | ||
260 | QIS.param = param; | ||
261 | 257 | ||
262 | // Add it to queue | 258 | /// <summary> |
263 | EventQueue.Enqueue(QIS); | 259 | /// Add event to event execution queue |
260 | /// </summary> | ||
261 | /// <param name="localID"></param> | ||
262 | /// <param name="itemID"></param> | ||
263 | /// <param name="FunctionName">Name of the function, will be state + "_event_" + FunctionName</param> | ||
264 | /// <param name="param">Array of parameters to match event mask</param> | ||
265 | public void AddToScriptQueue(uint localID, LLUUID itemID, string FunctionName, object[] param) | ||
266 | { | ||
267 | lock (QueueLock) | ||
268 | { | ||
269 | // Create a structure and add data | ||
270 | QueueItemStruct QIS = new QueueItemStruct(); | ||
271 | QIS.localID = localID; | ||
272 | QIS.itemID = itemID; | ||
273 | QIS.FunctionName = FunctionName; | ||
274 | QIS.param = param; | ||
264 | 275 | ||
265 | } | 276 | // Add it to queue |
277 | EventQueue.Enqueue(QIS); | ||
266 | } | 278 | } |
267 | |||
268 | } | 279 | } |
269 | 280 | ||
270 | } | 281 | } |