aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie Thielker2008-11-13 19:00:46 +0000
committerMelanie Thielker2008-11-13 19:00:46 +0000
commitca35b49b7043b6625e3fb02f0bfdd23bd3f16ae2 (patch)
tree860121f5f0477af04c12612193877470bec4a313
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
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs47
3 files changed, 15 insertions, 37 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 0e28b0c..19c9d08 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -2171,7 +2171,7 @@ namespace OpenSim.Region.Environment.Scenes
2171 group.UpdateGroupRotation(rot); 2171 group.UpdateGroupRotation(rot);
2172 //group.ApplyPhysics(m_physicalPrim); 2172 //group.ApplyPhysics(m_physicalPrim);
2173 group.Velocity = vel; 2173 group.Velocity = vel;
2174 group.CreateScriptInstances(param, true, DefaultScriptEngine, 0); 2174 group.CreateScriptInstances(param, true, DefaultScriptEngine, 2);
2175 rootPart.ScheduleFullUpdate(); 2175 rootPart.ScheduleFullUpdate();
2176 2176
2177 if (!ExternalChecks.ExternalChecksBypassPermissions()) 2177 if (!ExternalChecks.ExternalChecksBypassPermissions())
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
index f615250..dbcc4ed 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
@@ -39,7 +39,8 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
39 public enum StateSource 39 public enum StateSource
40 { 40 {
41 NewRez = 0, 41 NewRez = 0,
42 PrimCrossing = 1 42 PrimCrossing = 1,
43 ScriptedRez= 2
43 } 44 }
44 45
45 public interface IScriptWorkItem 46 public interface IScriptWorkItem
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)