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/LSL_ApiInventoryTests.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/LSL_ApiInventoryTests.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs index 36c7582..6dd6c17 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs | |||
@@ -94,7 +94,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
94 | TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId); | 94 | TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId); |
95 | 95 | ||
96 | LSL_Api api = new LSL_Api(); | 96 | LSL_Api api = new LSL_Api(); |
97 | api.Initialize(new ScriptInstance(m_engine, so1.RootPart, null, 0, false, int.MaxValue)); | 97 | api.Initialize(m_engine, so1.RootPart, null, null); |
98 | 98 | ||
99 | // Create a second object | 99 | // Create a second object |
100 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100); | 100 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100); |
@@ -127,7 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
127 | SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10); | 127 | SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10); |
128 | m_scene.AddSceneObject(so1); | 128 | m_scene.AddSceneObject(so1); |
129 | LSL_Api api = new LSL_Api(); | 129 | LSL_Api api = new LSL_Api(); |
130 | api.Initialize(new ScriptInstance(m_engine, so1.RootPart, null, 0, false, int.MaxValue)); | 130 | api.Initialize(m_engine, so1.RootPart, null, null); |
131 | 131 | ||
132 | // Create an object embedded inside the first | 132 | // Create an object embedded inside the first |
133 | UUID itemId = TestHelpers.ParseTail(0x20); | 133 | UUID itemId = TestHelpers.ParseTail(0x20); |
@@ -137,7 +137,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
137 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100); | 137 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100); |
138 | m_scene.AddSceneObject(so2); | 138 | m_scene.AddSceneObject(so2); |
139 | LSL_Api api2 = new LSL_Api(); | 139 | LSL_Api api2 = new LSL_Api(); |
140 | api2.Initialize(new ScriptInstance(m_engine, so2.RootPart, null, 0, false, int.MaxValue)); | 140 | api2.Initialize(m_engine, so2.RootPart, null, null); |
141 | 141 | ||
142 | // *** Firstly, we test where llAllowInventoryDrop() has not been called. *** | 142 | // *** Firstly, we test where llAllowInventoryDrop() has not been called. *** |
143 | api.llGiveInventory(so2.UUID.ToString(), inventoryItemName); | 143 | api.llGiveInventory(so2.UUID.ToString(), inventoryItemName); |