Mercurial > pub > ImplabNet
comparison Implab.Test/AsyncTests.cs @ 81:2c5631b43c7d v2
dispatch pool rewritten
author | cin |
---|---|
date | Fri, 26 Sep 2014 20:44:01 +0400 |
parents | 4f20870d0816 |
children | 4d308952fd5e |
comparison
equal
deleted
inserted
replaced
80:4f20870d0816 | 81:2c5631b43c7d |
---|---|
146 Assert.AreNotEqual(pid, p.Join()); | 146 Assert.AreNotEqual(pid, p.Join()); |
147 } | 147 } |
148 | 148 |
149 [TestMethod] | 149 [TestMethod] |
150 public void WorkerPoolSizeTest() { | 150 public void WorkerPoolSizeTest() { |
151 var pool = new WorkerPool(5, 10, 0); | 151 var pool = new WorkerPool(5, 10, 1); |
152 | 152 |
153 Assert.AreEqual(5, pool.PoolSize); | 153 Assert.AreEqual(5, pool.PoolSize); |
154 | 154 |
155 pool.Invoke(() => { Thread.Sleep(100000000); return 10; }); | 155 pool.Invoke(() => { Thread.Sleep(100000000); return 10; }); |
156 pool.Invoke(() => { Thread.Sleep(100000000); return 10; }); | 156 pool.Invoke(() => { Thread.Sleep(100000000); return 10; }); |
289 } | 289 } |
290 | 290 |
291 [TestMethod] | 291 [TestMethod] |
292 public void ChainedMapTest() { | 292 public void ChainedMapTest() { |
293 | 293 |
294 using (var pool = new WorkerPool(0,10,100)) { | 294 using (var pool = new WorkerPool(0,10,1)) { |
295 const int count = 10000; | 295 const int count = 10000; |
296 | 296 |
297 var args = new double[count]; | 297 var args = new double[count]; |
298 var rand = new Random(); | 298 var rand = new Random(); |
299 | 299 |