From 1b5c41c14ad11325be249ea1cce3c65d4d6a89be Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 16 Jan 2013 00:12:40 +0000
Subject: 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.
---
OpenSim/Region/ScriptEngine/Shared/Helpers.cs | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine/Shared/Helpers.cs')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
index 5a58f73..e02d35e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
@@ -81,6 +81,24 @@ namespace OpenSim.Region.ScriptEngine.Shared
}
}
+ ///
+ /// Used to signal when the script is stopping in co-operation with the script engine
+ /// (instead of through Thread.Abort()).
+ ///
+ [Serializable]
+ public class ScriptCoopStopException : Exception
+ {
+ public ScriptCoopStopException()
+ {
+ }
+
+ protected ScriptCoopStopException(
+ SerializationInfo info,
+ StreamingContext context)
+ {
+ }
+ }
+
public class DetectParams
{
public const int AGENT = 1;
--
cgit v1.1
From b8949024bc55c62b9268b35d4f2a568760b9d7d3 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 16 Jan 2013 01:45:09 +0000
Subject: Revert "Implement co-operative script termination if termination
comes during a script wait event (llSleep(), etc.)"
Doing this as a favour to Melanie. This will be back with passing the wait handles directly to the api.
This reverts commit 1b5c41c14ad11325be249ea1cce3c65d4d6a89be.
---
OpenSim/Region/ScriptEngine/Shared/Helpers.cs | 18 ------------------
1 file changed, 18 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine/Shared/Helpers.cs')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
index e02d35e..5a58f73 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
@@ -81,24 +81,6 @@ namespace OpenSim.Region.ScriptEngine.Shared
}
}
- ///
- /// Used to signal when the script is stopping in co-operation with the script engine
- /// (instead of through Thread.Abort()).
- ///
- [Serializable]
- public class ScriptCoopStopException : Exception
- {
- public ScriptCoopStopException()
- {
- }
-
- protected ScriptCoopStopException(
- SerializationInfo info,
- StreamingContext context)
- {
- }
- }
-
public class DetectParams
{
public const int AGENT = 1;
--
cgit v1.1
From 0963ece25bdef16852f5fd8ae4515a2f05d8b6e4 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 16 Jan 2013 02:07:43 +0000
Subject: 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.
---
OpenSim/Region/ScriptEngine/Shared/Helpers.cs | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine/Shared/Helpers.cs')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
index 5a58f73..e02d35e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
@@ -81,6 +81,24 @@ namespace OpenSim.Region.ScriptEngine.Shared
}
}
+ ///
+ /// Used to signal when the script is stopping in co-operation with the script engine
+ /// (instead of through Thread.Abort()).
+ ///
+ [Serializable]
+ public class ScriptCoopStopException : Exception
+ {
+ public ScriptCoopStopException()
+ {
+ }
+
+ protected ScriptCoopStopException(
+ SerializationInfo info,
+ StreamingContext context)
+ {
+ }
+ }
+
public class DetectParams
{
public const int AGENT = 1;
--
cgit v1.1