aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorTom Grimshaw2010-05-29 02:10:34 -0700
committerTom Grimshaw2010-05-29 02:10:34 -0700
commite3dac1292ef000daadda3e264354d8df0fc77c22 (patch)
tree932b9872e470b7ac7f20ed185dbba4b7caa17fa4 /OpenSim/Region/Framework/Scenes
parentMerge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/ca... (diff)
downloadopensim-SC_OLD-e3dac1292ef000daadda3e264354d8df0fc77c22.zip
opensim-SC_OLD-e3dac1292ef000daadda3e264354d8df0fc77c22.tar.gz
opensim-SC_OLD-e3dac1292ef000daadda3e264354d8df0fc77c22.tar.bz2
opensim-SC_OLD-e3dac1292ef000daadda3e264354d8df0fc77c22.tar.xz
Implement suspended updates - When an operation is occurring on lots of prims in a single group, don't schedule any updates until the operation has completed. This makes things like llSetAlpha(LINK_SET,0.0,ALL_SIDES); a *lot* faster, more efficient and less buggy, and also makes unlinking a lot better. Linking is still treacherous.. this needs to be analysed.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs47
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs8
3 files changed, 59 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index d4658ec..445c2c8 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1499,10 +1499,13 @@ namespace OpenSim.Region.Framework.Scenes
1499 /// <param name="childPrims"></param> 1499 /// <param name="childPrims"></param>
1500 protected internal void LinkObjects(SceneObjectPart root, List<SceneObjectPart> children) 1500 protected internal void LinkObjects(SceneObjectPart root, List<SceneObjectPart> children)
1501 { 1501 {
1502 SceneObjectGroup parentGroup = root.ParentGroup;
1503 if (parentGroup == null) return;
1502 Monitor.Enter(m_updateLock); 1504 Monitor.Enter(m_updateLock);
1505
1503 try 1506 try
1504 { 1507 {
1505 SceneObjectGroup parentGroup = root.ParentGroup; 1508 parentGroup.areUpdatesSuspended = true;
1506 1509
1507 List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); 1510 List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>();
1508 if (parentGroup != null) 1511 if (parentGroup != null)
@@ -1541,12 +1544,12 @@ namespace OpenSim.Region.Framework.Scenes
1541 // occur on link to invoke this elsewhere (such as object selection) 1544 // occur on link to invoke this elsewhere (such as object selection)
1542 parentGroup.RootPart.AddFlag(PrimFlags.CreateSelected); 1545 parentGroup.RootPart.AddFlag(PrimFlags.CreateSelected);
1543 parentGroup.TriggerScriptChangedEvent(Changed.LINK); 1546 parentGroup.TriggerScriptChangedEvent(Changed.LINK);
1544 parentGroup.HasGroupChanged = true;
1545 parentGroup.ScheduleGroupForFullUpdate();
1546
1547 } 1547 }
1548 finally 1548 finally
1549 { 1549 {
1550 parentGroup.areUpdatesSuspended = false;
1551 parentGroup.HasGroupChanged = true;
1552 parentGroup.ScheduleGroupForFullUpdate();
1550 Monitor.Exit(m_updateLock); 1553 Monitor.Exit(m_updateLock);
1551 } 1554 }
1552 } 1555 }
@@ -1583,11 +1586,22 @@ namespace OpenSim.Region.Framework.Scenes
1583 } 1586 }
1584 } 1587 }
1585 1588
1586 foreach (SceneObjectPart child in childParts) 1589 if (childParts.Count > 0)
1587 { 1590 {
1588 // Unlink all child parts from their groups 1591 try
1589 // 1592 {
1590 child.ParentGroup.DelinkFromGroup(child, true); 1593 childParts[0].ParentGroup.areUpdatesSuspended = true;
1594 foreach (SceneObjectPart child in childParts)
1595 {
1596 // Unlink all child parts from their groups
1597 //
1598 child.ParentGroup.DelinkFromGroup(child, true);
1599 }
1600 }
1601 finally
1602 {
1603 childParts[0].ParentGroup.areUpdatesSuspended = false;
1604 }
1591 } 1605 }
1592 1606
1593 foreach (SceneObjectPart root in rootParts) 1607 foreach (SceneObjectPart root in rootParts)
@@ -1611,10 +1625,21 @@ namespace OpenSim.Region.Framework.Scenes
1611 if (numChildren > 1) 1625 if (numChildren > 1)
1612 sendEventsToRemainder = false; 1626 sendEventsToRemainder = false;
1613 1627
1614 foreach (SceneObjectPart p in newSet) 1628 if (newSet.Count > 0)
1615 { 1629 {
1616 if (p != group.RootPart) 1630 try
1617 group.DelinkFromGroup(p, sendEventsToRemainder); 1631 {
1632 newSet[0].ParentGroup.areUpdatesSuspended = true;
1633 foreach (SceneObjectPart p in newSet)
1634 {
1635 if (p != group.RootPart)
1636 group.DelinkFromGroup(p, sendEventsToRemainder);
1637 }
1638 }
1639 finally
1640 {
1641 newSet[0].ParentGroup.areUpdatesSuspended = false;
1642 }
1618 } 1643 }
1619 1644
1620 // If there is more than one prim remaining, we 1645 // If there is more than one prim remaining, we
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index cee2be3..9ebb168 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -109,9 +109,26 @@ namespace OpenSim.Region.Framework.Scenes
109 private long m_maxPersistTime = 0; 109 private long m_maxPersistTime = 0;
110 private long m_minPersistTime = 0; 110 private long m_minPersistTime = 0;
111 private Random m_rand; 111 private Random m_rand;
112 private bool m_suspendUpdates;
112 113
113 private System.Threading.ReaderWriterLockSlim m_partsLock = new System.Threading.ReaderWriterLockSlim(); 114 private System.Threading.ReaderWriterLockSlim m_partsLock = new System.Threading.ReaderWriterLockSlim();
114 115
116 public bool areUpdatesSuspended
117 {
118 get
119 {
120 return m_suspendUpdates;
121 }
122 set
123 {
124 m_suspendUpdates = value;
125 if (!value)
126 {
127 QueueForUpdateCheck();
128 }
129 }
130 }
131
115 public void lockPartsForRead(bool locked) 132 public void lockPartsForRead(bool locked)
116 { 133 {
117 if (locked) 134 if (locked)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index c84596b..6e73b65 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2724,7 +2724,10 @@ namespace OpenSim.Region.Framework.Scenes
2724 2724
2725 if (m_parentGroup != null) 2725 if (m_parentGroup != null)
2726 { 2726 {
2727 m_parentGroup.QueueForUpdateCheck(); 2727 if (!m_parentGroup.areUpdatesSuspended)
2728 {
2729 m_parentGroup.QueueForUpdateCheck();
2730 }
2728 } 2731 }
2729 2732
2730 int timeNow = Util.UnixTimeSinceEpoch(); 2733 int timeNow = Util.UnixTimeSinceEpoch();
@@ -4450,8 +4453,9 @@ namespace OpenSim.Region.Framework.Scenes
4450 { 4453 {
4451 m_shape.TextureEntry = textureEntry; 4454 m_shape.TextureEntry = textureEntry;
4452 TriggerScriptChangedEvent(Changed.TEXTURE); 4455 TriggerScriptChangedEvent(Changed.TEXTURE);
4453 4456 m_updateFlag = 1;
4454 ParentGroup.HasGroupChanged = true; 4457 ParentGroup.HasGroupChanged = true;
4458
4455 //This is madness.. 4459 //This is madness..
4456 //ParentGroup.ScheduleGroupForFullUpdate(); 4460 //ParentGroup.ScheduleGroupForFullUpdate();
4457 //This is sparta 4461 //This is sparta