diff options
author | Justin Clark-Casey (justincc) | 2013-01-16 01:45:09 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-01-16 01:45:09 +0000 |
commit | b8949024bc55c62b9268b35d4f2a568760b9d7d3 (patch) | |
tree | 7b8d984c957fab7aba5aceec66967adb5e8a0d51 /OpenSim/Region/ScriptEngine/Shared/Api | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-b8949024bc55c62b9268b35d4f2a568760b9d7d3.zip opensim-SC-b8949024bc55c62b9268b35d4f2a568760b9d7d3.tar.gz opensim-SC-b8949024bc55c62b9268b35d4f2a568760b9d7d3.tar.bz2 opensim-SC-b8949024bc55c62b9268b35d4f2a568760b9d7d3.tar.xz |
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.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b992efa..44072c6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -83,12 +83,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
83 | public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi | 83 | public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi |
84 | { | 84 | { |
85 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 85 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
86 | |||
87 | /// <summary> | ||
88 | /// Instance of this script. | ||
89 | /// </summary> | ||
90 | protected IScriptInstance m_scriptInstance; | ||
91 | |||
92 | protected IScriptEngine m_ScriptEngine; | 86 | protected IScriptEngine m_ScriptEngine; |
93 | protected SceneObjectPart m_host; | 87 | protected SceneObjectPart m_host; |
94 | 88 | ||
@@ -118,12 +112,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
118 | 112 | ||
119 | public void Initialize(IScriptInstance scriptInstance) | 113 | public void Initialize(IScriptInstance scriptInstance) |
120 | { | 114 | { |
121 | m_scriptInstance = scriptInstance; | 115 | m_ScriptEngine = scriptInstance.Engine; |
122 | m_ScriptEngine = m_scriptInstance.Engine; | 116 | m_host = scriptInstance.Part; |
123 | m_host = m_scriptInstance.Part; | 117 | m_item = scriptInstance.ScriptTask; |
124 | m_item = m_scriptInstance.ScriptTask; | ||
125 | 118 | ||
126 | LoadConfig(); | 119 | LoadLimits(); // read script limits from config. |
127 | 120 | ||
128 | m_TransferModule = | 121 | m_TransferModule = |
129 | m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>(); | 122 | m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>(); |
@@ -136,7 +129,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
136 | /// <summary> | 129 | /// <summary> |
137 | /// Load configuration items that affect script, object and run-time behavior. */ | 130 | /// Load configuration items that affect script, object and run-time behavior. */ |
138 | /// </summary> | 131 | /// </summary> |
139 | private void LoadConfig() | 132 | private void LoadLimits() |
140 | { | 133 | { |
141 | m_ScriptDelayFactor = | 134 | m_ScriptDelayFactor = |
142 | m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); | 135 | m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); |
@@ -182,16 +175,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
182 | delay = (int)((float)delay * m_ScriptDelayFactor); | 175 | delay = (int)((float)delay * m_ScriptDelayFactor); |
183 | if (delay == 0) | 176 | if (delay == 0) |
184 | return; | 177 | return; |
185 | 178 | System.Threading.Thread.Sleep(delay); | |
186 | Sleep(delay); | ||
187 | } | ||
188 | |||
189 | protected virtual void Sleep(int delay) | ||
190 | { | ||
191 | if (!m_scriptInstance.CoopTermination) | ||
192 | System.Threading.Thread.Sleep(delay); | ||
193 | else if (m_scriptInstance.CoopSleepHandle.WaitOne(delay)) | ||
194 | throw new ScriptCoopStopException(); | ||
195 | } | 179 | } |
196 | 180 | ||
197 | public Scene World | 181 | public Scene World |
@@ -2930,8 +2914,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2930 | { | 2914 | { |
2931 | // m_log.Info("llSleep snoozing " + sec + "s."); | 2915 | // m_log.Info("llSleep snoozing " + sec + "s."); |
2932 | m_host.AddScriptLPS(1); | 2916 | m_host.AddScriptLPS(1); |
2933 | 2917 | Thread.Sleep((int)(sec * 1000)); | |
2934 | Sleep((int)(sec * 1000)); | ||
2935 | } | 2918 | } |
2936 | 2919 | ||
2937 | public LSL_Float llGetMass() | 2920 | public LSL_Float llGetMass() |