Merge commit '5607fd3af828846291de3358067bb1214619489e' into bigmerge

Conflicts:
	OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
	OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
avinationmerge
Melanie 2011-10-25 03:16:26 +01:00
commit 85d40ce1d1
2 changed files with 54 additions and 22 deletions

View File

@ -139,7 +139,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
{
@ -650,12 +674,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{
EventParams data = null;
// m_log.DebugFormat("[XEngine]: EventProcessor() invoked for {0}.{1}", PrimName, ScriptName);
if (Suspended)
return 0;
lock (m_EventQueue)
{
lock (m_Script)
{
data = (EventParams) m_EventQueue.Dequeue();
if (data == null) // Shouldn't happen
@ -681,7 +705,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
if (data.EventName == "collision")
m_CollisionInQueue = false;
}
}
lock(m_Script)
{

View File

@ -1009,7 +1009,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
// Do we even have it?
if (!m_Scripts.ContainsKey(itemID))
{
// Do we even have it?
if (!m_Scripts.ContainsKey(itemID))
return;
lockScriptsForRead(false);
lockScriptsForWrite(true);
m_Scripts.Remove(itemID);
lockScriptsForWrite(false);
return;
}