diff options
author | Justin Clark-Casey (justincc) | 2010-08-28 00:40:33 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-08-28 00:40:33 +0100 |
commit | 1c0b4457cdcd543f04bc818a987f6e3f2311098d (patch) | |
tree | 56b6a949423b5ca0f54b2c200e037052a9ac3ff0 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |
parent | minor: reduce log chattiness of "load iar" for IARs with lots of folders (diff) | |
download | opensim-SC_OLD-1c0b4457cdcd543f04bc818a987f6e3f2311098d.zip opensim-SC_OLD-1c0b4457cdcd543f04bc818a987f6e3f2311098d.tar.gz opensim-SC_OLD-1c0b4457cdcd543f04bc818a987f6e3f2311098d.tar.bz2 opensim-SC_OLD-1c0b4457cdcd543f04bc818a987f6e3f2311098d.tar.xz |
Improve liveness by operating on list copies of SOG.Children where appropriate
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index fc5eeed..40a8f83 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -237,6 +237,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
237 | 237 | ||
238 | /// <value> | 238 | /// <value> |
239 | /// The parts of this scene object group. You must lock this property before using it. | 239 | /// The parts of this scene object group. You must lock this property before using it. |
240 | /// If you're doing anything other than reading values, please take a copy of the values rather than locking | ||
241 | /// the dictionary for the entirety of the operation. This increases liveness and reduces the danger of deadlock | ||
240 | /// If you want to know the number of children, consider using the PrimCount property instead | 242 | /// If you want to know the number of children, consider using the PrimCount property instead |
241 | /// </value> | 243 | /// </value> |
242 | public Dictionary<UUID, SceneObjectPart> Children | 244 | public Dictionary<UUID, SceneObjectPart> Children |
@@ -1968,28 +1970,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
1968 | //if ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) | 1970 | //if ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) |
1969 | // return; | 1971 | // return; |
1970 | 1972 | ||
1971 | lock (m_parts) | 1973 | bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); |
1972 | { | ||
1973 | bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); | ||
1974 | 1974 | ||
1975 | if (UsePhysics && !AbsolutePosition.ApproxEquals(lastPhysGroupPos, 0.02f)) | 1975 | if (UsePhysics && !AbsolutePosition.ApproxEquals(lastPhysGroupPos, 0.02f)) |
1976 | { | 1976 | { |
1977 | m_rootPart.UpdateFlag = 1; | 1977 | m_rootPart.UpdateFlag = 1; |
1978 | lastPhysGroupPos = AbsolutePosition; | 1978 | lastPhysGroupPos = AbsolutePosition; |
1979 | } | 1979 | } |
1980 | 1980 | ||
1981 | if (UsePhysics && !GroupRotation.ApproxEquals(lastPhysGroupRot, 0.1f)) | 1981 | if (UsePhysics && !GroupRotation.ApproxEquals(lastPhysGroupRot, 0.1f)) |
1982 | { | 1982 | { |
1983 | m_rootPart.UpdateFlag = 1; | 1983 | m_rootPart.UpdateFlag = 1; |
1984 | lastPhysGroupRot = GroupRotation; | 1984 | lastPhysGroupRot = GroupRotation; |
1985 | } | 1985 | } |
1986 | 1986 | ||
1987 | foreach (SceneObjectPart part in m_parts.Values) | 1987 | List<SceneObjectPart> partList = null; |
1988 | { | 1988 | lock (m_parts) |
1989 | if (!IsSelected) | 1989 | partList = new List<SceneObjectPart>(m_parts.Values); |
1990 | part.UpdateLookAt(); | 1990 | |
1991 | part.SendScheduledUpdates(); | 1991 | foreach (SceneObjectPart part in partList) |
1992 | } | 1992 | { |
1993 | if (!IsSelected) | ||
1994 | part.UpdateLookAt(); | ||
1995 | part.SendScheduledUpdates(); | ||
1993 | } | 1996 | } |
1994 | } | 1997 | } |
1995 | 1998 | ||
@@ -2787,11 +2790,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2787 | public void UpdatePermissions(UUID AgentID, byte field, uint localID, | 2790 | public void UpdatePermissions(UUID AgentID, byte field, uint localID, |
2788 | uint mask, byte addRemTF) | 2791 | uint mask, byte addRemTF) |
2789 | { | 2792 | { |
2793 | List<SceneObjectPart> partList = null; | ||
2790 | lock (m_parts) | 2794 | lock (m_parts) |
2791 | { | 2795 | partList = new List<SceneObjectPart>(m_parts.Values); |
2792 | foreach (SceneObjectPart part in m_parts.Values) | 2796 | |
2793 | part.UpdatePermissions(AgentID, field, localID, mask, addRemTF); | 2797 | foreach (SceneObjectPart part in partList) |
2794 | } | 2798 | part.UpdatePermissions(AgentID, field, localID, mask, addRemTF); |
2795 | 2799 | ||
2796 | HasGroupChanged = true; | 2800 | HasGroupChanged = true; |
2797 | } | 2801 | } |