Mercurial > pub > ImplabNet
diff 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 |
line wrap: on
line diff
--- a/Implab.Test/PromiseHelper.cs Tue Oct 18 01:03:49 2016 +0300 +++ b/Implab.Test/PromiseHelper.cs Tue Oct 18 17:49:54 2016 +0300 @@ -10,5 +10,13 @@ return retVal; }); } + + public static IPromise Sleep(int timeout) { + return AsyncPool.Invoke((ct) => { + ct.CancellationRequested(ct.CancelOperation); + Thread.Sleep(timeout); + return 0; + }); + } } }