Mercurial > pub > ImplabNet
comparison Implab.Test/AsyncTests.cs @ 21:6a56df4ec59e promises
DispatchPool works again, but performance is poor in some cases
| author | cin |
|---|---|
| date | Tue, 12 Nov 2013 19:52:10 +0400 |
| parents | 1c3b3d518480 |
| children | 5a35900264f5 |
comparison
equal
deleted
inserted
replaced
| 20:1c3b3d518480 | 21:6a56df4ec59e |
|---|---|
| 149 [TestMethod] | 149 [TestMethod] |
| 150 public void WorkerPoolDisposeTest() { | 150 public void WorkerPoolDisposeTest() { |
| 151 var pool = new WorkerPool(5, 20); | 151 var pool = new WorkerPool(5, 20); |
| 152 Assert.AreEqual(5, pool.PoolSize); | 152 Assert.AreEqual(5, pool.PoolSize); |
| 153 pool.Dispose(); | 153 pool.Dispose(); |
| 154 Thread.Sleep(200); | 154 Thread.Sleep(500); |
| 155 Assert.AreEqual(0, pool.PoolSize); | 155 Assert.AreEqual(0, pool.PoolSize); |
| 156 pool.Dispose(); | 156 pool.Dispose(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 [TestMethod] | 159 [TestMethod] |
| 242 } | 242 } |
| 243 | 243 |
| 244 [TestMethod] | 244 [TestMethod] |
| 245 public void ChainedMapTest() { | 245 public void ChainedMapTest() { |
| 246 | 246 |
| 247 using (var pool = new WorkerPool(0,100,0)) { | 247 using (var pool = new WorkerPool(0,100,1)) { |
| 248 int count = 10000; | 248 int count = 10000; |
| 249 | 249 |
| 250 double[] args = new double[count]; | 250 double[] args = new double[count]; |
| 251 var rand = new Random(); | 251 var rand = new Random(); |
| 252 | 252 |
