aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs35
1 files changed, 30 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index a2ac9c5..275b608 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -243,7 +243,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
243 if (Engine.Config.GetString("ScriptStopStrategy", "abort") == "co-op") 243 if (Engine.Config.GetString("ScriptStopStrategy", "abort") == "co-op")
244 { 244 {
245 m_coopTermination = true; 245 m_coopTermination = true;
246 m_coopSleepHandle = new AutoResetEvent(false); 246 m_coopSleepHandle = new XEngineEventWaitHandle(false, EventResetMode.AutoReset);
247 } 247 }
248 } 248 }
249 249
@@ -529,8 +529,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
529 { 529 {
530 File.Delete(savedState); 530 File.Delete(savedState);
531 } 531 }
532 catch(Exception) 532 catch (Exception e)
533 { 533 {
534 m_log.Warn(
535 string.Format(
536 "[SCRIPT INSTANCE]: Could not delete script state {0} for script {1} (id {2}) in part {3} (id {4}) in object {5} in {6}. Exception ",
537 savedState, ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name),
538 e);
534 } 539 }
535 } 540 }
536 541
@@ -568,9 +573,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
568 573
569 public bool Stop(int timeout) 574 public bool Stop(int timeout)
570 { 575 {
571// m_log.DebugFormat( 576 if (DebugLevel >= 1)
572// "[SCRIPT INSTANCE]: Stopping script {0} {1} in {2} {3} with timeout {4} {5} {6}", 577 m_log.DebugFormat(
573// ScriptName, ItemID, PrimName, ObjectID, timeout, m_InSelfDelete, DateTime.Now.Ticks); 578 "[SCRIPT INSTANCE]: Stopping script {0} {1} in {2} {3} with timeout {4} {5} {6}",
579 ScriptName, ItemID, PrimName, ObjectID, timeout, m_InSelfDelete, DateTime.Now.Ticks);
574 580
575 IScriptWorkItem workItem; 581 IScriptWorkItem workItem;
576 582
@@ -1216,4 +1222,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
1216 Suspended = false; 1222 Suspended = false;
1217 } 1223 }
1218 } 1224 }
1225
1226 /// <summary>
1227 /// Xengine event wait handle.
1228 /// </summary>
1229 /// <remarks>
1230 /// This class exists becase XEngineScriptBase gets a reference to this wait handle. We need to make sure that
1231 /// when scripts are running in different AppDomains the lease does not expire.
1232 /// FIXME: Like LSL_Api, etc., this effectively leaks memory since the GC will never collect it. To avoid this,
1233 /// proper remoting sponsorship needs to be implemented across the board.
1234 /// </remarks>
1235 public class XEngineEventWaitHandle : EventWaitHandle
1236 {
1237 public XEngineEventWaitHandle(bool initialState, EventResetMode mode) : base(initialState, mode) {}
1238
1239 public override Object InitializeLifetimeService()
1240 {
1241 return null;
1242 }
1243 }
1219} 1244}