diff options
author | Melanie | 2011-10-25 03:16:26 +0100 |
---|---|---|
committer | Melanie | 2011-10-25 03:16:26 +0100 |
commit | 85d40ce1d1c3942faf325fa106a466deaa4bca46 (patch) | |
tree | 8db0d587cc1b1ce7106d3b057bad7e2d90d9423e /OpenSim/Region | |
parent | Merge commit '3cf7fb4eca2ad57835311e8098868f2571709392' into bigmerge (diff) | |
parent | Fix resume scripts. (diff) | |
download | opensim-SC-85d40ce1d1c3942faf325fa106a466deaa4bca46.zip opensim-SC-85d40ce1d1c3942faf325fa106a466deaa4bca46.tar.gz opensim-SC-85d40ce1d1c3942faf325fa106a466deaa4bca46.tar.bz2 opensim-SC-85d40ce1d1c3942faf325fa106a466deaa4bca46.tar.xz |
Merge commit '5607fd3af828846291de3358067bb1214619489e' into bigmerge
Conflicts:
OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 68 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 8 |
2 files changed, 54 insertions, 22 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 17c06e7..9ff2e4d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -139,7 +139,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
139 | set { m_RunEvents = value; } | 139 | set { m_RunEvents = value; } |
140 | } | 140 | } |
141 | 141 | ||
142 | public bool Suspended { get; set; } | 142 | public bool Suspended |
143 | { | ||
144 | get { return m_Suspended; } | ||
145 | |||
146 | set | ||
147 | { | ||
148 | // Need to do this inside a lock in order to avoid races with EventProcessor() | ||
149 | lock (m_Script) | ||
150 | { | ||
151 | bool wasSuspended = m_Suspended; | ||
152 | m_Suspended = value; | ||
153 | |||
154 | if (wasSuspended && !m_Suspended) | ||
155 | { | ||
156 | lock (m_EventQueue) | ||
157 | { | ||
158 | // Need to place ourselves back in a work item if there are events to process | ||
159 | if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) | ||
160 | m_CurrentResult = m_Engine.QueueEventHandler(this); | ||
161 | } | ||
162 | } | ||
163 | } | ||
164 | } | ||
165 | } | ||
166 | private bool m_Suspended; | ||
143 | 167 | ||
144 | public bool ShuttingDown | 168 | public bool ShuttingDown |
145 | { | 169 | { |
@@ -650,38 +674,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
650 | { | 674 | { |
651 | EventParams data = null; | 675 | EventParams data = null; |
652 | 676 | ||
677 | // m_log.DebugFormat("[XEngine]: EventProcessor() invoked for {0}.{1}", PrimName, ScriptName); | ||
678 | |||
653 | if (Suspended) | 679 | if (Suspended) |
654 | return 0; | 680 | return 0; |
655 | 681 | ||
656 | lock (m_EventQueue) | 682 | lock (m_EventQueue) |
657 | { | 683 | { |
658 | lock (m_Script) | 684 | data = (EventParams) m_EventQueue.Dequeue(); |
685 | if (data == null) // Shouldn't happen | ||
659 | { | 686 | { |
660 | data = (EventParams) m_EventQueue.Dequeue(); | 687 | if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) |
661 | if (data == null) // Shouldn't happen | ||
662 | { | 688 | { |
663 | if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) | 689 | m_CurrentResult = m_Engine.QueueEventHandler(this); |
664 | { | ||
665 | m_CurrentResult = m_Engine.QueueEventHandler(this); | ||
666 | } | ||
667 | else | ||
668 | { | ||
669 | m_CurrentResult = null; | ||
670 | } | ||
671 | return 0; | ||
672 | } | 690 | } |
673 | 691 | else | |
674 | if (data.EventName == "timer") | ||
675 | m_TimerQueued = false; | ||
676 | if (data.EventName == "control") | ||
677 | { | 692 | { |
678 | if (m_ControlEventsInQueue > 0) | 693 | m_CurrentResult = null; |
679 | m_ControlEventsInQueue--; | ||
680 | } | 694 | } |
681 | if (data.EventName == "collision") | 695 | return 0; |
682 | m_CollisionInQueue = false; | ||
683 | } | 696 | } |
697 | |||
698 | if (data.EventName == "timer") | ||
699 | m_TimerQueued = false; | ||
700 | if (data.EventName == "control") | ||
701 | { | ||
702 | if (m_ControlEventsInQueue > 0) | ||
703 | m_ControlEventsInQueue--; | ||
704 | } | ||
705 | if (data.EventName == "collision") | ||
706 | m_CollisionInQueue = false; | ||
684 | } | 707 | } |
708 | |||
685 | lock(m_Script) | 709 | lock(m_Script) |
686 | { | 710 | { |
687 | 711 | ||
@@ -693,7 +717,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
693 | { | 717 | { |
694 | // m_log.DebugFormat("[Script] Script {0}.{1} state set to {2}", | 718 | // m_log.DebugFormat("[Script] Script {0}.{1} state set to {2}", |
695 | // m_PrimName, m_ScriptName, data.Params[0].ToString()); | 719 | // m_PrimName, m_ScriptName, data.Params[0].ToString()); |
696 | m_State=data.Params[0].ToString(); | 720 | m_State = data.Params[0].ToString(); |
697 | AsyncCommandManager.RemoveScript(m_Engine, | 721 | AsyncCommandManager.RemoveScript(m_Engine, |
698 | m_LocalID, m_ItemID); | 722 | m_LocalID, m_ItemID); |
699 | 723 | ||
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 696c216..aa11eca 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1009,7 +1009,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1009 | // Do we even have it? | 1009 | // Do we even have it? |
1010 | if (!m_Scripts.ContainsKey(itemID)) | 1010 | if (!m_Scripts.ContainsKey(itemID)) |
1011 | { | 1011 | { |
1012 | // Do we even have it? | ||
1013 | if (!m_Scripts.ContainsKey(itemID)) | ||
1014 | return; | ||
1015 | |||
1012 | lockScriptsForRead(false); | 1016 | lockScriptsForRead(false); |
1017 | lockScriptsForWrite(true); | ||
1018 | m_Scripts.Remove(itemID); | ||
1019 | lockScriptsForWrite(false); | ||
1020 | |||
1013 | return; | 1021 | return; |
1014 | } | 1022 | } |
1015 | 1023 | ||