diff options
author | Melanie | 2010-06-23 21:14:28 +0100 |
---|---|---|
committer | Melanie | 2010-06-23 21:14:28 +0100 |
commit | c404c5fb5405eac24cc8b7cd402eb8d8fb0ff0cf (patch) | |
tree | 8e02f744c4483326b9111818bac83b206f852370 /OpenSim/Region | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC-c404c5fb5405eac24cc8b7cd402eb8d8fb0ff0cf.zip opensim-SC-c404c5fb5405eac24cc8b7cd402eb8d8fb0ff0cf.tar.gz opensim-SC-c404c5fb5405eac24cc8b7cd402eb8d8fb0ff0cf.tar.bz2 opensim-SC-c404c5fb5405eac24cc8b7cd402eb8d8fb0ff0cf.tar.xz |
Thank you, Snoopy, for a patch to reduce sim script startup CPU usage
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 866bb6e..3a8f168 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -31,6 +31,7 @@ using System.IO; | |||
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Collections; | 32 | using System.Collections; |
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | using System.Threading; | ||
34 | using OpenMetaverse; | 35 | using OpenMetaverse; |
35 | using log4net; | 36 | using log4net; |
36 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
@@ -200,6 +201,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
200 | if ((int)InventoryType.LSL == item.InvType) | 201 | if ((int)InventoryType.LSL == item.InvType) |
201 | { | 202 | { |
202 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); | 203 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); |
204 | Thread.Sleep(10); // workaround for Mono cpu utilization > 100% bug | ||
203 | } | 205 | } |
204 | } | 206 | } |
205 | } | 207 | } |
@@ -257,7 +259,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
257 | // m_log.InfoFormat( | 259 | // m_log.InfoFormat( |
258 | // "[PRIM INVENTORY]: " + | 260 | // "[PRIM INVENTORY]: " + |
259 | // "Starting script {0}, {1} in prim {2}, {3}", | 261 | // "Starting script {0}, {1} in prim {2}, {3}", |
260 | // item.Name, item.ItemID, Name, UUID); | 262 | // item.Name, item.ItemID, m_part.Name, m_part.UUID); |
261 | 263 | ||
262 | if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) | 264 | if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) |
263 | return; | 265 | return; |
@@ -293,20 +295,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
293 | } | 295 | } |
294 | else | 296 | else |
295 | { | 297 | { |
296 | if (m_part.ParentGroup.m_savedScriptState != null) | ||
297 | RestoreSavedScriptState(item.OldItemID, item.ItemID); | ||
298 | |||
299 | lock (m_items) | 298 | lock (m_items) |
300 | { | 299 | { |
300 | if (m_part.ParentGroup.m_savedScriptState != null) | ||
301 | RestoreSavedScriptState(item.OldItemID, item.ItemID); | ||
302 | |||
301 | m_items[item.ItemID].PermsMask = 0; | 303 | m_items[item.ItemID].PermsMask = 0; |
302 | m_items[item.ItemID].PermsGranter = UUID.Zero; | 304 | m_items[item.ItemID].PermsGranter = UUID.Zero; |
305 | |||
306 | string script = Utils.BytesToString(asset.Data); | ||
307 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( | ||
308 | m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); | ||
309 | m_part.ParentGroup.AddActiveScriptCount(1); | ||
310 | m_part.ScheduleFullUpdate(); | ||
303 | } | 311 | } |
304 | |||
305 | string script = Utils.BytesToString(asset.Data); | ||
306 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( | ||
307 | m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); | ||
308 | m_part.ParentGroup.AddActiveScriptCount(1); | ||
309 | m_part.ScheduleFullUpdate(); | ||
310 | } | 312 | } |
311 | } | 313 | } |
312 | } | 314 | } |