diff options
author | Justin Clark-Casey (justincc) | 2013-01-16 02:07:43 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-01-16 02:07:43 +0000 |
commit | 0963ece25bdef16852f5fd8ae4515a2f05d8b6e4 (patch) | |
tree | f95a3eef3e94df4408d555a30cd62bce629623f2 /OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs | |
parent | Revert "Implement co-operative script termination if termination comes during... (diff) | |
download | opensim-SC-0963ece25bdef16852f5fd8ae4515a2f05d8b6e4.zip opensim-SC-0963ece25bdef16852f5fd8ae4515a2f05d8b6e4.tar.gz opensim-SC-0963ece25bdef16852f5fd8ae4515a2f05d8b6e4.tar.bz2 opensim-SC-0963ece25bdef16852f5fd8ae4515a2f05d8b6e4.tar.xz |
Implement co-operative script termination if termination comes during a script wait event (llSleep(), etc.)
This makes use of EventWaitHandles since various web references indicate that Thread.Interrupt() can also cause runtime instability.
If co-op termination is enabled, then termination sets the wait handle instead of waiting for a timeout before possibly aborting the thread.
This allows the script to cleanly terminate if it's in a llSleep/LL function delay or the next time it enters such a wait without any timeout period.
Co-op termination is not yet testable since checking for termination request within loops that never trigger a wait is not yet implemented.
This commit, unlike 1b5c41c, passes the wait handle as an extra parameter through IScript.Initialize() instead of passing IScriptInstance itself.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs index e7b3319..b2803a1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs | |||
@@ -99,10 +99,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
99 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); | 99 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); |
100 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); | 100 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); |
101 | 101 | ||
102 | ScriptInstance si = new ScriptInstance(m_engine, inWorldObj.RootPart, scriptItem, 0, false, int.MaxValue); | 102 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); |
103 | new LSL_Api().Initialize(si); | ||
104 | OSSL_Api osslApi = new OSSL_Api(); | 103 | OSSL_Api osslApi = new OSSL_Api(); |
105 | osslApi.Initialize(si); | 104 | osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); |
106 | 105 | ||
107 | // SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID); | 106 | // SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID); |
108 | 107 | ||
@@ -146,10 +145,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
146 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); | 145 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); |
147 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); | 146 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); |
148 | 147 | ||
149 | ScriptInstance si = new ScriptInstance(m_engine, inWorldObj.RootPart, scriptItem, 0, false, int.MaxValue); | 148 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); |
150 | new LSL_Api().Initialize(si); | ||
151 | OSSL_Api osslApi = new OSSL_Api(); | 149 | OSSL_Api osslApi = new OSSL_Api(); |
152 | osslApi.Initialize(si); | 150 | osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); |
153 | 151 | ||
154 | // Create an object embedded inside the first | 152 | // Create an object embedded inside the first |
155 | TaskInventoryHelpers.AddNotecard( | 153 | TaskInventoryHelpers.AddNotecard( |
@@ -195,10 +193,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
195 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); | 193 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); |
196 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); | 194 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); |
197 | 195 | ||
198 | ScriptInstance si = new ScriptInstance(m_engine, inWorldObj.RootPart, scriptItem, 0, false, int.MaxValue); | 196 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); |
199 | new LSL_Api().Initialize(si); | ||
200 | OSSL_Api osslApi = new OSSL_Api(); | 197 | OSSL_Api osslApi = new OSSL_Api(); |
201 | osslApi.Initialize(si); | 198 | osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); |
202 | 199 | ||
203 | // Create an object embedded inside the first | 200 | // Create an object embedded inside the first |
204 | TaskInventoryHelpers.AddSceneObject( | 201 | TaskInventoryHelpers.AddSceneObject( |