Thank you, Snoopy, for a patch to reduce sim script startup CPU usage
parent
7db5262e35
commit
c404c5fb54
|
@ -31,6 +31,7 @@ using System.IO;
|
|||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using OpenMetaverse;
|
||||
using log4net;
|
||||
using OpenSim.Framework;
|
||||
|
@ -200,6 +201,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if ((int)InventoryType.LSL == item.InvType)
|
||||
{
|
||||
CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
|
||||
Thread.Sleep(10); // workaround for Mono cpu utilization > 100% bug
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -257,7 +259,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// m_log.InfoFormat(
|
||||
// "[PRIM INVENTORY]: " +
|
||||
// "Starting script {0}, {1} in prim {2}, {3}",
|
||||
// item.Name, item.ItemID, Name, UUID);
|
||||
// item.Name, item.ItemID, m_part.Name, m_part.UUID);
|
||||
|
||||
if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID))
|
||||
return;
|
||||
|
@ -292,15 +294,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID);
|
||||
}
|
||||
else
|
||||
{
|
||||
lock (m_items)
|
||||
{
|
||||
if (m_part.ParentGroup.m_savedScriptState != null)
|
||||
RestoreSavedScriptState(item.OldItemID, item.ItemID);
|
||||
|
||||
lock (m_items)
|
||||
{
|
||||
m_items[item.ItemID].PermsMask = 0;
|
||||
m_items[item.ItemID].PermsGranter = UUID.Zero;
|
||||
}
|
||||
|
||||
string script = Utils.BytesToString(asset.Data);
|
||||
m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
|
||||
|
@ -310,6 +311,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RestoreSavedScriptState(UUID oldID, UUID newID)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue