Make scripts in objects rezzed from script compile synchronously to close

a timing gap. Still not 100%, but getting there
0.6.1-post-fixes
Melanie Thielker 2008-11-13 19:00:46 +00:00
parent ef601d805a
commit ca35b49b70
3 changed files with 16 additions and 38 deletions

View File

@ -2171,7 +2171,7 @@ namespace OpenSim.Region.Environment.Scenes
group.UpdateGroupRotation(rot); group.UpdateGroupRotation(rot);
//group.ApplyPhysics(m_physicalPrim); //group.ApplyPhysics(m_physicalPrim);
group.Velocity = vel; group.Velocity = vel;
group.CreateScriptInstances(param, true, DefaultScriptEngine, 0); group.CreateScriptInstances(param, true, DefaultScriptEngine, 2);
rootPart.ScheduleFullUpdate(); rootPart.ScheduleFullUpdate();
if (!ExternalChecks.ExternalChecksBypassPermissions()) if (!ExternalChecks.ExternalChecksBypassPermissions())

View File

@ -39,7 +39,8 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
public enum StateSource public enum StateSource
{ {
NewRez = 0, NewRez = 0,
PrimCrossing = 1 PrimCrossing = 1,
ScriptedRez= 2
} }
public interface IScriptWorkItem public interface IScriptWorkItem

View File

@ -77,7 +77,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
#pragma warning restore 414 #pragma warning restore 414
private int m_EventLimit; private int m_EventLimit;
private bool m_KillTimedOutScripts; private bool m_KillTimedOutScripts;
// bool m_firstStart = true;
private static List<XEngine> m_ScriptEngines = private static List<XEngine> m_ScriptEngines =
new List<XEngine>(); new List<XEngine>();
@ -390,46 +389,24 @@ namespace OpenSim.Region.ScriptEngine.XEngine
Object[] parms = new Object[]{localID, itemID, script, startParam, postOnRez, (StateSource)stateSource}; Object[] parms = new Object[]{localID, itemID, script, startParam, postOnRez, (StateSource)stateSource};
if (stateSource == (int)StateSource.ScriptedRez)
{
DoOnRezScript(parms);
}
else
{
lock (m_CompileQueue) lock (m_CompileQueue)
{ {
m_CompileQueue.Enqueue(parms); m_CompileQueue.Enqueue(parms);
if (m_CurrentCompile == null) if (m_CurrentCompile == null)
{ {
// if (m_firstStart)
// {
// m_firstStart = false;
// m_CurrentCompile = m_ThreadPool.QueueWorkItem(
// new WorkItemCallback(this.DoScriptWait),
// new Object[0]);
// return;
// }
m_CurrentCompile = m_ThreadPool.QueueWorkItem( m_CurrentCompile = m_ThreadPool.QueueWorkItem(
new WorkItemCallback(this.DoOnRezScriptQueue), new WorkItemCallback(this.DoOnRezScriptQueue),
new Object[0]); new Object[0]);
} }
} }
} }
public Object DoScriptWait(Object dummy)
{
Thread.Sleep(10000);
lock (m_CompileQueue)
{
if (m_CompileQueue.Count > 0)
{
m_CurrentCompile = m_ThreadPool.QueueWorkItem(
new WorkItemCallback(this.DoOnRezScriptQueue),
new Object[0]);
}
else
{
m_CurrentCompile = null;
}
}
return null;
} }
public Object DoOnRezScriptQueue(Object dummy) public Object DoOnRezScriptQueue(Object dummy)