diff options
author | Justin Clarke Casey | 2009-02-17 16:51:09 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-02-17 16:51:09 +0000 |
commit | 4e779bbd8129c8fb0b2c109ca2912265ca85c8a5 (patch) | |
tree | 3d805495ea0a58fcd1aba0c3b9eb11f5688f1733 /OpenSim/Region/CoreModules/World/Archiver | |
parent | * Get rid of a unit test race condition based on my misreading of the AutoRes... (diff) | |
download | opensim-SC-4e779bbd8129c8fb0b2c109ca2912265ca85c8a5.zip opensim-SC-4e779bbd8129c8fb0b2c109ca2912265ca85c8a5.tar.gz opensim-SC-4e779bbd8129c8fb0b2c109ca2912265ca85c8a5.tar.bz2 opensim-SC-4e779bbd8129c8fb0b2c109ca2912265ca85c8a5.tar.xz |
* switch to pulsing monitors to perform test sync instead of events, since this doesn't allow one to accidentally forget to reset the event
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Archiver')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 25fffc4..bde15b3 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -43,11 +43,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
43 | [TestFixture] | 43 | [TestFixture] |
44 | public class ArchiverTests | 44 | public class ArchiverTests |
45 | { | 45 | { |
46 | private EventWaitHandle m_waitHandle = new ManualResetEvent(false); | ||
47 | |||
48 | private void SaveCompleted(string errorMessage) | 46 | private void SaveCompleted(string errorMessage) |
49 | { | 47 | { |
50 | m_waitHandle.Set(); | 48 | lock (this) |
49 | { | ||
50 | Monitor.PulseAll(this); | ||
51 | } | ||
51 | } | 52 | } |
52 | 53 | ||
53 | /// <summary> | 54 | /// <summary> |
@@ -103,12 +104,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
103 | scene.AddNewSceneObject(new SceneObjectGroup(part2), false); | 104 | scene.AddNewSceneObject(new SceneObjectGroup(part2), false); |
104 | } | 105 | } |
105 | 106 | ||
106 | MemoryStream archiveWriteStream = new MemoryStream(); | 107 | MemoryStream archiveWriteStream = new MemoryStream(); |
107 | |||
108 | scene.EventManager.OnOarFileSaved += SaveCompleted; | 108 | scene.EventManager.OnOarFileSaved += SaveCompleted; |
109 | archiverModule.ArchiveRegion(archiveWriteStream); | 109 | |
110 | m_waitHandle.WaitOne(60000, true); | 110 | lock (this) |
111 | m_waitHandle.Reset(); | 111 | { |
112 | archiverModule.ArchiveRegion(archiveWriteStream); | ||
113 | Monitor.Wait(this, 60000); | ||
114 | } | ||
112 | 115 | ||
113 | byte[] archive = archiveWriteStream.ToArray(); | 116 | byte[] archive = archiveWriteStream.ToArray(); |
114 | MemoryStream archiveReadStream = new MemoryStream(archive); | 117 | MemoryStream archiveReadStream = new MemoryStream(archive); |
@@ -251,9 +254,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
251 | 254 | ||
252 | // Write out this scene | 255 | // Write out this scene |
253 | scene.EventManager.OnOarFileSaved += SaveCompleted; | 256 | scene.EventManager.OnOarFileSaved += SaveCompleted; |
254 | archiverModule.ArchiveRegion(archiveWriteStream); | 257 | |
255 | m_waitHandle.WaitOne(60000, true); | 258 | lock (this) |
256 | m_waitHandle.Reset(); | 259 | { |
260 | archiverModule.ArchiveRegion(archiveWriteStream); | ||
261 | Monitor.Wait(this, 60000); | ||
262 | } | ||
257 | } | 263 | } |
258 | 264 | ||
259 | { | 265 | { |