Mercurial > pub > ImplabNet
comparison Implab.Test/PromiseHelper.cs @ 203:4d9830a9bbb8 v2
Added 'Fail' method to RunnableComponent which allows component to move from
Running to Failed state.
Added PollingComponent a timer based runnable component
More tests
Added FailPromise a thin class to wrap exceptions
Fixed error handling in SuccessPromise classes.
| author | cin | 
|---|---|
| date | Tue, 18 Oct 2016 17:49:54 +0300 | 
| parents | eb793fbbe4ea | 
| children | d82909310094 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 202:2651cb9a4250 | 203:4d9830a9bbb8 | 
|---|---|
| 8 ct.CancellationRequested(ct.CancelOperation); | 8 ct.CancellationRequested(ct.CancelOperation); | 
| 9 Thread.Sleep(timeout); | 9 Thread.Sleep(timeout); | 
| 10 return retVal; | 10 return retVal; | 
| 11 }); | 11 }); | 
| 12 } | 12 } | 
| 13 | |
| 14 public static IPromise Sleep(int timeout) { | |
| 15 return AsyncPool.Invoke((ct) => { | |
| 16 ct.CancellationRequested(ct.CancelOperation); | |
| 17 Thread.Sleep(timeout); | |
| 18 return 0; | |
| 19 }); | |
| 20 } | |
| 13 } | 21 } | 
| 14 } | 22 } | 
