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.ApplyPhysics(m_physicalPrim);
group.Velocity = vel;
group.CreateScriptInstances(param, true, DefaultScriptEngine, 0);
group.CreateScriptInstances(param, true, DefaultScriptEngine, 2);
rootPart.ScheduleFullUpdate();
if (!ExternalChecks.ExternalChecksBypassPermissions())

View File

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

View File

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