comparison Implab.Test/AsyncTests.cs @ 19:e3935fdf59a2 promises

Promise is rewritten to use interlocked operations instead of locks
author cin
date Sun, 10 Nov 2013 00:21:33 +0400
parents 7cd4a843b4e4
children 1c3b3d518480
comparison
equal deleted inserted replaced
17:7cd4a843b4e4 19:e3935fdf59a2
12 int res = -1; 12 int res = -1;
13 var p = new Promise<int>(); 13 var p = new Promise<int>();
14 p.Then(x => res = x); 14 p.Then(x => res = x);
15 p.Resolve(100); 15 p.Resolve(100);
16 16
17 Assert.AreEqual(res, 100); 17 Assert.AreEqual(100, res);
18 } 18 }
19 19
20 [TestMethod] 20 [TestMethod]
21 public void RejectTest() { 21 public void RejectTest() {
22 int res = -1; 22 int res = -1;
242 } 242 }
243 243
244 [TestMethod] 244 [TestMethod]
245 public void ChainedMapTest() { 245 public void ChainedMapTest() {
246 246
247 using (var pool = new WorkerPool(8,100,0)) { 247 using (var pool = new WorkerPool(4,4,0)) {
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