aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-12-17 21:37:02 +0000
committerJustin Clark-Casey (justincc)2012-12-17 21:37:02 +0000
commite6fd8365af0b0dc7a4664278c369752cb4e87155 (patch)
tree194233d93d9518ffc3ee1419e7ed6859cba72d77 /OpenSim/Region/ScriptEngine
parentBulletSim: fix vehicles being shot in the air at border crossings because of ... (diff)
downloadopensim-SC_OLD-e6fd8365af0b0dc7a4664278c369752cb4e87155.zip
opensim-SC_OLD-e6fd8365af0b0dc7a4664278c369752cb4e87155.tar.gz
opensim-SC_OLD-e6fd8365af0b0dc7a4664278c369752cb4e87155.tar.bz2
opensim-SC_OLD-e6fd8365af0b0dc7a4664278c369752cb4e87155.tar.xz
Extend default 1 second wait for event completion to other thread script reset (as called by llResetOtherScript()).
As with script stop (via llDie()) aborting other scripts event threads, llResetOtherScript() can also abort any current event thread on another script. On mono 2.6, 2.10 and possibly later this may cause locking problems in certain code areas. This commit reuses the recently introduced [XEngine] WaitForEventCompletionOnScriptStop to make this a 1 sec timeout, rather than 0 secs.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs31
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs2
3 files changed, 33 insertions, 4 deletions
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
index 00a99c3..2f5b526 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
@@ -147,7 +147,13 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
147 /// <summary> 147 /// <summary>
148 /// Stop the script instance. 148 /// Stop the script instance.
149 /// </summary> 149 /// </summary>
150 /// <remarks>
151 /// This must not be called by a thread that is in the process of handling an event for this script. Otherwise
152 /// there is a danger that it will self-abort and not complete the reset.
153 /// </remarks>
150 /// <param name="timeout"></param> 154 /// <param name="timeout"></param>
155 /// How many milliseconds we will wait for an existing script event to finish before
156 /// forcibly aborting that event.
151 /// <returns>true if the script was successfully stopped, false otherwise</returns> 157 /// <returns>true if the script was successfully stopped, false otherwise</returns>
152 bool Stop(int timeout); 158 bool Stop(int timeout);
153 159
@@ -169,8 +175,31 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
169 object EventProcessor(); 175 object EventProcessor();
170 176
171 int EventTime(); 177 int EventTime();
172 void ResetScript(); 178
179 /// <summary>
180 /// Reset the script.
181 /// </summary>
182 /// <remarks>
183 /// This must not be called by a thread that is in the process of handling an event for this script. Otherwise
184 /// there is a danger that it will self-abort and not complete the reset. Such a thread must call
185 /// ApiResetScript() instead.
186 /// </remarks>
187 /// <param name='timeout'>
188 /// How many milliseconds we will wait for an existing script event to finish before
189 /// forcibly aborting that event prior to script reset.
190 /// </param>
191 void ResetScript(int timeout);
192
193 /// <summary>
194 /// Reset the script.
195 /// </summary>
196 /// <remarks>
197 /// This must not be called by any thread other than the one executing the scripts current event. This is
198 /// because there is no wait or abort logic if another thread is in the middle of processing a script event.
199 /// Such an external thread should use ResetScript() instead.
200 /// </remarks>
173 void ApiResetScript(); 201 void ApiResetScript();
202
174 Dictionary<string, object> GetVars(); 203 Dictionary<string, object> GetVars();
175 void SetVars(Dictionary<string, object> vars); 204 void SetVars(Dictionary<string, object> vars);
176 DetectParams GetDetectParams(int idx); 205 DetectParams GetDetectParams(int idx);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index dfe8386..01a5e34 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -877,7 +877,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
877 return (DateTime.Now - m_EventStart).Seconds; 877 return (DateTime.Now - m_EventStart).Seconds;
878 } 878 }
879 879
880 public void ResetScript() 880 public void ResetScript(int timeout)
881 { 881 {
882 if (m_Script == null) 882 if (m_Script == null)
883 return; 883 return;
@@ -887,7 +887,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
887 RemoveState(); 887 RemoveState();
888 ReleaseControls(); 888 ReleaseControls();
889 889
890 Stop(0); 890 Stop(timeout);
891 SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID); 891 SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
892 part.Inventory.GetInventoryItem(ItemID).PermsMask = 0; 892 part.Inventory.GetInventoryItem(ItemID).PermsMask = 0;
893 part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero; 893 part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero;
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 1dd50c7..f38d17d 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1691,7 +1691,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1691 { 1691 {
1692 IScriptInstance instance = GetInstance(itemID); 1692 IScriptInstance instance = GetInstance(itemID);
1693 if (instance != null) 1693 if (instance != null)
1694 instance.ResetScript(); 1694 instance.ResetScript(m_WaitForEventCompletionOnScriptStop);
1695 } 1695 }
1696 1696
1697 public void StartScript(UUID itemID) 1697 public void StartScript(UUID itemID)