mirror of
https://github.com/opensim/opensim.git
synced 2026-08-09 18:55:58 +08:00
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.
This commit is contained in:
@@ -94,7 +94,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||
TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId);
|
||||
|
||||
LSL_Api api = new LSL_Api();
|
||||
api.Initialize(new ScriptInstance(m_engine, so1.RootPart, null, 0, false, int.MaxValue));
|
||||
api.Initialize(m_engine, so1.RootPart, null, null);
|
||||
|
||||
// Create a second object
|
||||
SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100);
|
||||
@@ -127,7 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||
SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
|
||||
m_scene.AddSceneObject(so1);
|
||||
LSL_Api api = new LSL_Api();
|
||||
api.Initialize(new ScriptInstance(m_engine, so1.RootPart, null, 0, false, int.MaxValue));
|
||||
api.Initialize(m_engine, so1.RootPart, null, null);
|
||||
|
||||
// Create an object embedded inside the first
|
||||
UUID itemId = TestHelpers.ParseTail(0x20);
|
||||
@@ -137,7 +137,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||
SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100);
|
||||
m_scene.AddSceneObject(so2);
|
||||
LSL_Api api2 = new LSL_Api();
|
||||
api2.Initialize(new ScriptInstance(m_engine, so2.RootPart, null, 0, false, int.MaxValue));
|
||||
api2.Initialize(m_engine, so2.RootPart, null, null);
|
||||
|
||||
// *** Firstly, we test where llAllowInventoryDrop() has not been called. ***
|
||||
api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
|
||||
|
||||
Reference in New Issue
Block a user