From 1dd904b78e723af8cb4340415a8f41dcd1054541 Mon Sep 17 00:00:00 2001
From: Oren Hurvitz
Date: Mon, 5 Sep 2011 12:45:02 +0300
Subject: Delay loading scripts until the scene has finished loading
---
OpenSim/Region/Application/OpenSimBase.cs | 2 ++
.../Region/Framework/Interfaces/IScriptModule.cs | 5 +++++
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 24 ++++++++++++++++++++--
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 3 +++
4 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 00b080c..92e8ed1 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -411,6 +411,8 @@ namespace OpenSim
scene.StartTimer();
+ scene.StartScripts();
+
return clientServer;
}
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
index d9752e6..b27b7da 100644
--- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
@@ -52,5 +52,10 @@ namespace OpenSim.Region.Framework.Interfaces
ArrayList GetScriptErrors(UUID itemID);
void SaveAllState();
+
+ ///
+ /// Starts the processing threads.
+ ///
+ void StartProcessing();
}
}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 4700c3b..9dcd10a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -57,11 +57,11 @@ namespace OpenSim.Region.Framework.Scenes
protected AsyncInventorySender m_asyncInventorySender;
///
- /// Start all the scripts in the scene which should be started.
+ /// Creates all the scripts in the scene which should be started.
///
public void CreateScriptInstances()
{
- m_log.Info("[PRIM INVENTORY]: Starting scripts in scene");
+ m_log.Info("[PRIM INVENTORY]: Creating scripts in scene");
EntityBase[] entities = Entities.GetEntities();
foreach (EntityBase group in entities)
@@ -74,6 +74,26 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ ///
+ /// Lets the script engines start processing scripts.
+ ///
+ public void StartScripts()
+ {
+ m_log.Info("[PRIM INVENTORY]: Starting scripts in scene");
+
+ IScriptModule[] engines = RequestModuleInterfaces();
+ if (engines != null)
+ {
+ foreach (IScriptModule engine in engines)
+ {
+ if (engine != null)
+ {
+ engine.StartProcessing();
+ }
+ }
+ }
+ }
+
public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item)
{
IMoneyModule money = RequestModuleInterface();
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index c443669..55f373e 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -339,7 +339,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
m_ThreadPool.QueueWorkItem(new WorkItemCallback(this.DoBackup),
new Object[] { m_SaveTime });
}
+ }
+ public void StartProcessing()
+ {
m_ThreadPool.Start();
}
--
cgit v1.1