Fix resume scripts.
On resume, we need to place requeue the script for event processing if there are any events on the queue. Also need to do this under m_Script lock in order to avoid a raceremove-scene-viewer
parent
3cf7fb4eca
commit
5607fd3af8
|
@ -55,7 +55,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
{
|
||||
public class ScriptInstance : MarshalByRefObject, IScriptInstance
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IScriptEngine m_Engine;
|
||||
private IScriptWorkItem m_CurrentResult = null;
|
||||
|
@ -138,7 +138,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
set { m_RunEvents = value; }
|
||||
}
|
||||
|
||||
public bool Suspended { get; set; }
|
||||
public bool Suspended
|
||||
{
|
||||
get { return m_Suspended; }
|
||||
|
||||
set
|
||||
{
|
||||
// Need to do this inside a lock in order to avoid races with EventProcessor()
|
||||
lock (m_Script)
|
||||
{
|
||||
bool wasSuspended = m_Suspended;
|
||||
m_Suspended = value;
|
||||
|
||||
if (wasSuspended && !m_Suspended)
|
||||
{
|
||||
lock (m_EventQueue)
|
||||
{
|
||||
// Need to place ourselves back in a work item if there are events to process
|
||||
if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
|
||||
m_CurrentResult = m_Engine.QueueEventHandler(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private bool m_Suspended;
|
||||
|
||||
public bool ShuttingDown
|
||||
{
|
||||
|
@ -645,13 +669,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
/// <returns></returns>
|
||||
public object EventProcessor()
|
||||
{
|
||||
lock (m_Script)
|
||||
{
|
||||
// m_log.DebugFormat("[XEngine]: EventProcessor() invoked for {0}.{1}", PrimName, ScriptName);
|
||||
|
||||
if (Suspended)
|
||||
return 0;
|
||||
|
||||
lock (m_Script)
|
||||
{
|
||||
EventParams data = null;
|
||||
|
||||
lock (m_EventQueue)
|
||||
|
|
Loading…
Reference in New Issue