mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 00:46:02 +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:
@@ -81,6 +81,24 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to signal when the script is stopping in co-operation with the script engine
|
||||
/// (instead of through Thread.Abort()).
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class ScriptCoopStopException : Exception
|
||||
{
|
||||
public ScriptCoopStopException()
|
||||
{
|
||||
}
|
||||
|
||||
protected ScriptCoopStopException(
|
||||
SerializationInfo info,
|
||||
StreamingContext context)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class DetectParams
|
||||
{
|
||||
public const int AGENT = 1;
|
||||
|
||||
Reference in New Issue
Block a user