diff options
author | Justin Clark-Casey (justincc) | 2013-01-16 00:12:40 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-01-16 00:12:40 +0000 |
commit | 1b5c41c14ad11325be249ea1cce3c65d4d6a89be (patch) | |
tree | 987e140c9402c48cc8daf59d2b8af165646cc93a /OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | |
parent | Instead of passing separate engine, part and item components to script APIs, ... (diff) | |
download | opensim-SC-1b5c41c14ad11325be249ea1cce3c65d4d6a89be.zip opensim-SC-1b5c41c14ad11325be249ea1cce3c65d4d6a89be.tar.gz opensim-SC-1b5c41c14ad11325be249ea1cce3c65d4d6a89be.tar.bz2 opensim-SC-1b5c41c14ad11325be249ea1cce3c65d4d6a89be.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.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs index 9de2d72..38fff52 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Threading; | ||
31 | using OpenMetaverse; | 32 | using OpenMetaverse; |
32 | using log4net; | 33 | using log4net; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
@@ -181,6 +182,18 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
181 | void Resume(); | 182 | void Resume(); |
182 | 183 | ||
183 | /// <summary> | 184 | /// <summary> |
185 | /// If true then scripts should look to terminate their threads in co-operation with the script engine rather | ||
186 | /// than through Thread.Abort() | ||
187 | /// </summary> | ||
188 | bool CoopTermination { get; } | ||
189 | |||
190 | /// <summary> | ||
191 | /// Used for script sleeps when we are using co-operative script termination. | ||
192 | /// </summary> | ||
193 | /// <remarks>null if CoopTermination is not active</remarks> | ||
194 | EventWaitHandle CoopSleepHandle { get; } | ||
195 | |||
196 | /// <summary> | ||
184 | /// Process the next event queued for this script instance. | 197 | /// Process the next event queued for this script instance. |
185 | /// </summary> | 198 | /// </summary> |
186 | /// <returns></returns> | 199 | /// <returns></returns> |