aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/OdePlugin.cs')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs20
1 files changed, 19 insertions, 1 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 4175978..4c3dcd3 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -206,6 +206,13 @@ namespace OpenSim.Region.Physics.OdePlugin
206 mesher = meshmerizer; 206 mesher = meshmerizer;
207 } 207 }
208 208
209 internal void waitForSpaceUnlock(IntPtr space)
210 {
211 while (d.SpaceLockQuery(space))
212 {
213
214 }
215 }
209 /// <summary> 216 /// <summary>
210 /// Debug space message for printing the space that a prim/avatar is in. 217 /// Debug space message for printing the space that a prim/avatar is in.
211 /// </summary> 218 /// </summary>
@@ -635,8 +642,10 @@ namespace OpenSim.Region.Physics.OdePlugin
635 { 642 {
636 if (!(prim.m_targetSpace.Equals(null))) 643 if (!(prim.m_targetSpace.Equals(null)))
637 { 644 {
645
638 if (d.GeomIsSpace(prim.m_targetSpace)) 646 if (d.GeomIsSpace(prim.m_targetSpace))
639 { 647 {
648 waitForSpaceUnlock(prim.m_targetSpace);
640 d.SpaceRemove(prim.m_targetSpace, prim.prim_geom); 649 d.SpaceRemove(prim.m_targetSpace, prim.prim_geom);
641 } 650 }
642 else 651 else
@@ -656,6 +665,7 @@ namespace OpenSim.Region.Physics.OdePlugin
656 { 665 {
657 if (d.GeomIsSpace(prim.m_targetSpace)) 666 if (d.GeomIsSpace(prim.m_targetSpace))
658 { 667 {
668 waitForSpaceUnlock(prim.m_targetSpace);
659 d.SpaceRemove(space, prim.m_targetSpace); 669 d.SpaceRemove(space, prim.m_targetSpace);
660 // free up memory used by the space. 670 // free up memory used by the space.
661 d.SpaceDestroy(prim.m_targetSpace); 671 d.SpaceDestroy(prim.m_targetSpace);
@@ -723,6 +733,7 @@ namespace OpenSim.Region.Physics.OdePlugin
723 { 733 {
724 if (d.GeomIsSpace(currentspace)) 734 if (d.GeomIsSpace(currentspace))
725 { 735 {
736 waitForSpaceUnlock(currentspace);
726 d.SpaceRemove(currentspace, geom); 737 d.SpaceRemove(currentspace, geom);
727 } 738 }
728 else 739 else
@@ -741,6 +752,7 @@ namespace OpenSim.Region.Physics.OdePlugin
741 { 752 {
742 if (d.GeomIsSpace(currentspace)) 753 if (d.GeomIsSpace(currentspace))
743 { 754 {
755 waitForSpaceUnlock(sGeomIsIn);
744 d.SpaceRemove(sGeomIsIn, geom); 756 d.SpaceRemove(sGeomIsIn, geom);
745 } 757 }
746 else 758 else
@@ -761,8 +773,11 @@ namespace OpenSim.Region.Physics.OdePlugin
761 { 773 {
762 if (d.GeomIsSpace(currentspace)) 774 if (d.GeomIsSpace(currentspace))
763 { 775 {
776 waitForSpaceUnlock(currentspace);
777 waitForSpaceUnlock(space);
764 d.SpaceRemove(space, currentspace); 778 d.SpaceRemove(space, currentspace);
765 // free up memory used by the space. 779 // free up memory used by the space.
780
766 d.SpaceDestroy(currentspace); 781 d.SpaceDestroy(currentspace);
767 resetSpaceArrayItemToZero(currentspace); 782 resetSpaceArrayItemToZero(currentspace);
768 } 783 }
@@ -783,6 +798,7 @@ namespace OpenSim.Region.Physics.OdePlugin
783 if (currentspace != (IntPtr) 0) 798 if (currentspace != (IntPtr) 0)
784 if (d.GeomIsSpace(currentspace)) 799 if (d.GeomIsSpace(currentspace))
785 { 800 {
801 waitForSpaceUnlock(currentspace);
786 d.SpaceRemove(currentspace, geom); 802 d.SpaceRemove(currentspace, geom);
787 } 803 }
788 else 804 else
@@ -801,6 +817,7 @@ namespace OpenSim.Region.Physics.OdePlugin
801 { 817 {
802 if (d.GeomIsSpace(sGeomIsIn)) 818 if (d.GeomIsSpace(sGeomIsIn))
803 { 819 {
820 waitForSpaceUnlock(sGeomIsIn);
804 d.SpaceRemove(sGeomIsIn, geom); 821 d.SpaceRemove(sGeomIsIn, geom);
805 } 822 }
806 else 823 else
@@ -840,6 +857,7 @@ namespace OpenSim.Region.Physics.OdePlugin
840 { 857 {
841 // creating a new space for prim and inserting it into main space. 858 // creating a new space for prim and inserting it into main space.
842 staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY] = d.HashSpaceCreate(IntPtr.Zero); 859 staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY] = d.HashSpaceCreate(IntPtr.Zero);
860 waitForSpaceUnlock(space);
843 d.SpaceAdd(space, staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]); 861 d.SpaceAdd(space, staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]);
844 return staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]; 862 return staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY];
845 } 863 }