Yengine: try fix changing scripts running state if the have long events

This commit is contained in:
UbitUmarov
2019-04-01 13:58:41 +01:00
parent 3b63699b9d
commit 7f55db72d2
4 changed files with 96 additions and 23 deletions

View File

@@ -363,8 +363,33 @@ namespace OpenSim.Region.ScriptEngine.Yengine
lock(m_QueueLock)
{
m_Running = value;
if(!value)
if(value)
{
if (m_IState == XMRInstState.SUSPENDED && m_SuspendCount == 0)
{
if(eventCode != ScriptEventCode.None)
{
m_IState = XMRInstState.ONYIELDQ;
m_Engine.QueueToYield(this);
}
else if ((m_EventQueue != null) && (m_EventQueue.First != null))
{
m_IState = XMRInstState.ONSTARTQ;
m_Engine.QueueToStart(this);
}
else
m_IState = XMRInstState.IDLE;
}
else if(m_SuspendCount != 0)
m_IState = XMRInstState.IDLE;
}
else
{
if(m_IState == XMRInstState.ONSLEEPQ)
{
m_Engine.RemoveFromSleep(this);
m_IState = XMRInstState.SUSPENDED;
}
EmptyEventQueues();
}
}