Mercurial > pub > ImplabNet
comparison Implab.Test/PromiseHelper.cs @ 192:f1da3afc3521 release v2.1
Слияние с v2
| author | cin |
|---|---|
| date | Fri, 22 Apr 2016 13:10:34 +0300 |
| parents | eb793fbbe4ea |
| children | 4d9830a9bbb8 |
comparison
equal
deleted
inserted
replaced
| 71:1714fd8678ef | 192:f1da3afc3521 |
|---|---|
| 1 using Implab.Parallels; | 1 using Implab.Parallels; |
| 2 using System; | |
| 3 using System.Collections.Generic; | |
| 4 using System.Linq; | |
| 5 using System.Text; | |
| 6 using System.Threading; | 2 using System.Threading; |
| 7 | 3 |
| 8 namespace Implab.Test { | 4 namespace Implab.Test { |
| 9 class PromiseHelper { | 5 static class PromiseHelper { |
| 10 public static Promise<T> Sleep<T>(int timeout, T retVal) { | 6 public static IPromise<T> Sleep<T>(int timeout, T retVal) { |
| 11 return AsyncPool.Invoke(() => { | 7 return AsyncPool.Invoke((ct) => { |
| 8 ct.CancellationRequested(ct.CancelOperation); | |
| 12 Thread.Sleep(timeout); | 9 Thread.Sleep(timeout); |
| 13 return retVal; | 10 return retVal; |
| 14 }); | 11 }); |
| 15 } | 12 } |
| 16 } | 13 } |
