diff options
author | UbitUmarov | 2019-01-25 03:19:48 +0000 |
---|---|---|
committer | UbitUmarov | 2019-01-25 03:19:48 +0000 |
commit | 27f5248d9f9f312ee07c9d77d61161fbc0486379 (patch) | |
tree | e8954a8b006bf91399bc7dac44e4bc5a8e283f29 /OpenSim/Region/Framework/Scenes | |
parent | change threads confusing names (diff) | |
download | opensim-SC-27f5248d9f9f312ee07c9d77d61161fbc0486379.zip opensim-SC-27f5248d9f9f312ee07c9d77d61161fbc0486379.tar.gz opensim-SC-27f5248d9f9f312ee07c9d77d61161fbc0486379.tar.bz2 opensim-SC-27f5248d9f9f312ee07c9d77d61161fbc0486379.tar.xz |
Ooops fix bad locking
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 129 |
1 files changed, 60 insertions, 69 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 206e317..b67b83a 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -97,6 +97,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
97 | /// conditions can occur. | 97 | /// conditions can occur. |
98 | /// </remarks> | 98 | /// </remarks> |
99 | private Object m_updateLock = new Object(); | 99 | private Object m_updateLock = new Object(); |
100 | private Object m_linkLock = new Object(); | ||
100 | private System.Threading.ReaderWriterLockSlim m_scenePresencesLock; | 101 | private System.Threading.ReaderWriterLockSlim m_scenePresencesLock; |
101 | private System.Threading.ReaderWriterLockSlim m_scenePartsLock; | 102 | private System.Threading.ReaderWriterLockSlim m_scenePartsLock; |
102 | 103 | ||
@@ -634,41 +635,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
634 | /// </summary> | 635 | /// </summary> |
635 | protected internal void UpdateObjectGroups() | 636 | protected internal void UpdateObjectGroups() |
636 | { | 637 | { |
637 | if (!Monitor.TryEnter(m_updateLock)) | 638 | Dictionary<UUID, SceneObjectGroup> updates; |
638 | return; | 639 | // Get the current list of updates and clear the list before iterating |
639 | try | 640 | lock (m_updateLock) |
640 | { | 641 | { |
641 | Dictionary<UUID, SceneObjectGroup> updates; | 642 | updates = m_updateList; |
642 | // Get the current list of updates and clear the list before iterating | 643 | m_updateList = new Dictionary<UUID, SceneObjectGroup>(); |
643 | lock (m_updateLock) | 644 | } |
645 | |||
646 | // Go through all updates | ||
647 | foreach (SceneObjectGroup sog in updates.Values) | ||
648 | { | ||
649 | if (sog.IsDeleted) | ||
650 | continue; | ||
651 | |||
652 | // Don't abort the whole update if one entity happens to give us an exception. | ||
653 | try | ||
644 | { | 654 | { |
645 | updates = m_updateList; | 655 | sog.Update(); |
646 | m_updateList = new Dictionary<UUID, SceneObjectGroup>(); | ||
647 | } | 656 | } |
648 | 657 | catch (Exception e) | |
649 | // Go through all updates | ||
650 | foreach (SceneObjectGroup sog in updates.Values) | ||
651 | { | 658 | { |
652 | if (sog.IsDeleted) | 659 | m_log.ErrorFormat( |
653 | continue; | 660 | "[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e); |
654 | |||
655 | // Don't abort the whole update if one entity happens to give us an exception. | ||
656 | try | ||
657 | { | ||
658 | sog.Update(); | ||
659 | } | ||
660 | catch (Exception e) | ||
661 | { | ||
662 | m_log.ErrorFormat( | ||
663 | "[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e); | ||
664 | } | ||
665 | } | 661 | } |
666 | updates = null; | ||
667 | } | ||
668 | finally | ||
669 | { | ||
670 | Monitor.Exit(m_updateLock); | ||
671 | } | 662 | } |
663 | updates = null; | ||
672 | } | 664 | } |
673 | 665 | ||
674 | protected internal void AddPhysicalPrim(int number) | 666 | protected internal void AddPhysicalPrim(int number) |
@@ -1704,46 +1696,45 @@ namespace OpenSim.Region.Framework.Scenes | |||
1704 | protected internal void UpdatePrimFlags( | 1696 | protected internal void UpdatePrimFlags( |
1705 | uint localID, bool UsePhysics, bool SetTemporary, bool SetPhantom, ExtraPhysicsData PhysData, IClientAPI remoteClient) | 1697 | uint localID, bool UsePhysics, bool SetTemporary, bool SetPhantom, ExtraPhysicsData PhysData, IClientAPI remoteClient) |
1706 | { | 1698 | { |
1707 | SceneObjectGroup group = GetGroupByPrim(localID); | 1699 | SceneObjectPart part = GetSceneObjectPart(localID); |
1708 | if (group != null) | 1700 | if(part == null) |
1709 | { | 1701 | return; |
1710 | if (m_parentScene.Permissions.CanEditObject(group, remoteClient)) | 1702 | SceneObjectGroup group = part.ParentGroup; |
1711 | { | 1703 | if(group == null || group.IsDeleted) |
1712 | // VolumeDetect can't be set via UI and will always be off when a change is made there | 1704 | return; |
1713 | // now only change volume dtc if phantom off | ||
1714 | 1705 | ||
1715 | bool wantedPhys = UsePhysics; | 1706 | if (!m_parentScene.Permissions.CanEditObject(group, remoteClient)) |
1716 | if (PhysData.PhysShapeType == PhysShapeType.invalid) // check for extraPhysics data | 1707 | return; |
1717 | { | ||
1718 | bool vdtc; | ||
1719 | if (SetPhantom) // if phantom keep volumedtc | ||
1720 | vdtc = group.RootPart.VolumeDetectActive; | ||
1721 | else // else turn it off | ||
1722 | vdtc = false; | ||
1723 | 1708 | ||
1724 | group.UpdateFlags(UsePhysics, SetTemporary, SetPhantom, vdtc); | 1709 | // VolumeDetect can't be set via UI and will always be off when a change is made there |
1725 | } | 1710 | // now only change volume dtc if phantom off |
1726 | else | ||
1727 | { | ||
1728 | SceneObjectPart part = group.GetPart(localID); | ||
1729 | if (part != null) | ||
1730 | { | ||
1731 | part.UpdateExtraPhysics(PhysData); | ||
1732 | if (remoteClient != null) | ||
1733 | remoteClient.SendPartPhysicsProprieties(part); | ||
1734 | } | ||
1735 | } | ||
1736 | 1711 | ||
1737 | if (wantedPhys != group.UsesPhysics && remoteClient != null) | 1712 | bool wantedPhys = UsePhysics; |
1738 | { | 1713 | if (PhysData.PhysShapeType == PhysShapeType.invalid) // check for extraPhysics data |
1739 | if(m_parentScene.m_linksetPhysCapacity != 0) | 1714 | { |
1740 | remoteClient.SendAlertMessage("Object physics cancelled because it exceeds limits for physical prims, either size or number of primswith shape type not set to None"); | 1715 | bool vdtc; |
1741 | else | 1716 | if (SetPhantom) // if phantom keep volumedtc |
1742 | remoteClient.SendAlertMessage("Object physics cancelled because it exceeds size limits for physical prims"); | 1717 | vdtc = group.RootPart.VolumeDetectActive; |
1718 | else // else turn it off | ||
1719 | vdtc = false; | ||
1720 | |||
1721 | group.UpdateFlags(UsePhysics, SetTemporary, SetPhantom, vdtc); | ||
1722 | } | ||
1723 | else | ||
1724 | { | ||
1725 | part.UpdateExtraPhysics(PhysData); | ||
1726 | if (remoteClient != null) | ||
1727 | remoteClient.SendPartPhysicsProprieties(part); | ||
1728 | } | ||
1729 | |||
1730 | if (wantedPhys != group.UsesPhysics && remoteClient != null) | ||
1731 | { | ||
1732 | if(m_parentScene.m_linksetPhysCapacity != 0) | ||
1733 | remoteClient.SendAlertMessage("Object physics cancelled because it exceeds limits for physical prims, either size or number of primswith shape type not set to None"); | ||
1734 | else | ||
1735 | remoteClient.SendAlertMessage("Object physics cancelled because it exceeds size limits for physical prims"); | ||
1743 | 1736 | ||
1744 | group.RootPart.ScheduleFullUpdate(); | 1737 | group.RootPart.ScheduleFullUpdate(); |
1745 | } | ||
1746 | } | ||
1747 | } | 1738 | } |
1748 | } | 1739 | } |
1749 | 1740 | ||
@@ -1899,7 +1890,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1899 | if (parentGroup.OwnerID == parentGroup.GroupID) | 1890 | if (parentGroup.OwnerID == parentGroup.GroupID) |
1900 | return; | 1891 | return; |
1901 | 1892 | ||
1902 | Monitor.Enter(m_updateLock); | 1893 | Monitor.Enter(m_linkLock); |
1903 | 1894 | ||
1904 | try | 1895 | try |
1905 | { | 1896 | { |
@@ -1962,7 +1953,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1962 | parentGroup.HasGroupChanged = true; | 1953 | parentGroup.HasGroupChanged = true; |
1963 | parentGroup.ProcessBackup(m_parentScene.SimulationDataService, true); | 1954 | parentGroup.ProcessBackup(m_parentScene.SimulationDataService, true); |
1964 | parentGroup.ScheduleGroupForFullAnimUpdate(); | 1955 | parentGroup.ScheduleGroupForFullAnimUpdate(); |
1965 | Monitor.Exit(m_updateLock); | 1956 | Monitor.Exit(m_linkLock); |
1966 | } | 1957 | } |
1967 | } | 1958 | } |
1968 | 1959 | ||
@@ -1972,7 +1963,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1972 | /// <param name="prims"></param> | 1963 | /// <param name="prims"></param> |
1973 | protected internal void DelinkObjects(List<SceneObjectPart> prims) | 1964 | protected internal void DelinkObjects(List<SceneObjectPart> prims) |
1974 | { | 1965 | { |
1975 | Monitor.Enter(m_updateLock); | 1966 | Monitor.Enter(m_linkLock); |
1976 | try | 1967 | try |
1977 | { | 1968 | { |
1978 | List<SceneObjectPart> childParts = new List<SceneObjectPart>(); | 1969 | List<SceneObjectPart> childParts = new List<SceneObjectPart>(); |
@@ -2090,7 +2081,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2090 | } | 2081 | } |
2091 | finally | 2082 | finally |
2092 | { | 2083 | { |
2093 | Monitor.Exit(m_updateLock); | 2084 | Monitor.Exit(m_linkLock); |
2094 | } | 2085 | } |
2095 | } | 2086 | } |
2096 | 2087 | ||