From 21cad5d3ac68ceb4ac48346835ac087ecb107446 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Mon, 19 Apr 2010 06:29:26 +0100
Subject: All scripts are now created suspended and are only unsuspended when
the object is fully rezzed and all scripts in it are instantiated. This
ensures that link messages will not be lost on rez/region crossing and makes
heavily scripted objects reliable.
---
.../Region/ScriptEngine/Interfaces/IScriptInstance.cs | 3 +++
.../ScriptEngine/Shared/Instance/ScriptInstance.cs | 14 ++++++++++++++
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 18 ++++++++++++++++++
3 files changed, 35 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
index ae148a9..9f6ea35 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
@@ -81,6 +81,9 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
void PostEvent(EventParams data);
+ void Suspend();
+ void Resume();
+
///
/// Process the next event queued for this script
///
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index d30d2dc..74f25aa 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -95,6 +95,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
private bool m_startedFromSavedState;
private UUID m_CurrentStateHash;
private UUID m_RegionID;
+ private bool m_Suspended = true;
private Dictionary, KeyValuePair>
m_LineMap;
@@ -638,6 +639,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
///
public object EventProcessor()
{
+ if (m_Suspended)
+ return 0;
+
lock (m_Script)
{
EventParams data = null;
@@ -1011,5 +1015,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{
get { return m_RegionID; }
}
+
+ public void Suspend()
+ {
+ m_Suspended = true;
+ }
+
+ public void Resume()
+ {
+ m_Suspended = false;
+ }
}
}
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 98e77c0..54074ed 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1488,5 +1488,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return new ArrayList();
}
}
+
+ public void SuspendScript(UUID itemID)
+ {
+ IScriptInstance instance = GetInstance(itemID);
+ if (instance == null)
+ return;
+
+ instance.Suspend();
+ }
+
+ public void ResumeScript(UUID itemID)
+ {
+ IScriptInstance instance = GetInstance(itemID);
+ if (instance == null)
+ return;
+
+ instance.Resume();
+ }
}
}
--
cgit v1.1
From a89208b465ff935d769ecac70c7697d273ddb406 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Mon, 19 Apr 2010 14:14:31 +0100
Subject: Stopgap measure. Disable the recent script startup changes until I
can cure the race condition.
---
OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 74f25aa..3dd381d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -95,7 +95,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
private bool m_startedFromSavedState;
private UUID m_CurrentStateHash;
private UUID m_RegionID;
- private bool m_Suspended = true;
+ private bool m_Suspended = false;
private Dictionary, KeyValuePair>
m_LineMap;
--
cgit v1.1