aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine
diff options
context:
space:
mode:
authorMelanie Thielker2008-11-13 19:00:46 +0000
committerMelanie Thielker2008-11-13 19:00:46 +0000
commitca35b49b7043b6625e3fb02f0bfdd23bd3f16ae2 (patch)
tree860121f5f0477af04c12612193877470bec4a313 /OpenSim/Region/ScriptEngine/XEngine
parent* First part of a series of patches (diff)
downloadopensim-SC-ca35b49b7043b6625e3fb02f0bfdd23bd3f16ae2.zip
opensim-SC-ca35b49b7043b6625e3fb02f0bfdd23bd3f16ae2.tar.gz
opensim-SC-ca35b49b7043b6625e3fb02f0bfdd23bd3f16ae2.tar.bz2
opensim-SC-ca35b49b7043b6625e3fb02f0bfdd23bd3f16ae2.tar.xz
Make scripts in objects rezzed from script compile synchronously to close
a timing gap. Still not 100%, but getting there
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs47
1 files changed, 12 insertions, 35 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 6584bb3..e5dfb2b 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -77,7 +77,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
77#pragma warning restore 414 77#pragma warning restore 414
78 private int m_EventLimit; 78 private int m_EventLimit;
79 private bool m_KillTimedOutScripts; 79 private bool m_KillTimedOutScripts;
80// bool m_firstStart = true;
81 80
82 private static List<XEngine> m_ScriptEngines = 81 private static List<XEngine> m_ScriptEngines =
83 new List<XEngine>(); 82 new List<XEngine>();
@@ -390,46 +389,24 @@ namespace OpenSim.Region.ScriptEngine.XEngine
390 389
391 Object[] parms = new Object[]{localID, itemID, script, startParam, postOnRez, (StateSource)stateSource}; 390 Object[] parms = new Object[]{localID, itemID, script, startParam, postOnRez, (StateSource)stateSource};
392 391
393 lock (m_CompileQueue) 392 if (stateSource == (int)StateSource.ScriptedRez)
394 { 393 {
395 m_CompileQueue.Enqueue(parms); 394 DoOnRezScript(parms);
396
397 if (m_CurrentCompile == null)
398 {
399// if (m_firstStart)
400// {
401// m_firstStart = false;
402// m_CurrentCompile = m_ThreadPool.QueueWorkItem(
403// new WorkItemCallback(this.DoScriptWait),
404// new Object[0]);
405// return;
406// }
407
408 m_CurrentCompile = m_ThreadPool.QueueWorkItem(
409 new WorkItemCallback(this.DoOnRezScriptQueue),
410 new Object[0]);
411 }
412 } 395 }
413 } 396 else
414
415 public Object DoScriptWait(Object dummy)
416 {
417 Thread.Sleep(10000);
418
419 lock (m_CompileQueue)
420 { 397 {
421 if (m_CompileQueue.Count > 0) 398 lock (m_CompileQueue)
422 { 399 {
423 m_CurrentCompile = m_ThreadPool.QueueWorkItem( 400 m_CompileQueue.Enqueue(parms);
424 new WorkItemCallback(this.DoOnRezScriptQueue), 401
425 new Object[0]); 402 if (m_CurrentCompile == null)
426 } 403 {
427 else 404 m_CurrentCompile = m_ThreadPool.QueueWorkItem(
428 { 405 new WorkItemCallback(this.DoOnRezScriptQueue),
429 m_CurrentCompile = null; 406 new Object[0]);
407 }
430 } 408 }
431 } 409 }
432 return null;
433 } 410 }
434 411
435 public Object DoOnRezScriptQueue(Object dummy) 412 public Object DoOnRezScriptQueue(Object dummy)