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/XEngine/XEngine.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 '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 186ae04..a17a018 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1716,9 +1716,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1716 | IScriptInstance instance = GetInstance(itemID); | 1716 | IScriptInstance instance = GetInstance(itemID); |
1717 | 1717 | ||
1718 | if (instance != null) | 1718 | if (instance != null) |
1719 | { | ||
1719 | instance.Stop(m_WaitForEventCompletionOnScriptStop); | 1720 | instance.Stop(m_WaitForEventCompletionOnScriptStop); |
1721 | } | ||
1720 | else | 1722 | else |
1723 | { | ||
1724 | // m_log.DebugFormat("[XENGINE]: Could not find script with ID {0} to stop in {1}", itemID, World.Name); | ||
1721 | m_runFlags.AddOrUpdate(itemID, false, 240); | 1725 | m_runFlags.AddOrUpdate(itemID, false, 240); |
1726 | } | ||
1722 | } | 1727 | } |
1723 | 1728 | ||
1724 | public DetectParams GetDetectParams(UUID itemID, int idx) | 1729 | public DetectParams GetDetectParams(UUID itemID, int idx) |