Mercurial > pub > ImplabNet
view Implab.Test/PromiseHelper.cs @ 210:5dc21f6a3222 v2
Code review for RunnableComponent
Added StaApartment class based on System.Windows.Forms.Application message loop
author | cin |
---|---|
date | Mon, 20 Mar 2017 17:44:18 +0300 |
parents | 4d9830a9bbb8 |
children | d82909310094 |
line wrap: on
line source
using Implab.Parallels; using System.Threading; namespace Implab.Test { static class PromiseHelper { public static IPromise<T> Sleep<T>(int timeout, T retVal) { return AsyncPool.Invoke((ct) => { ct.CancellationRequested(ct.CancelOperation); Thread.Sleep(timeout); return retVal; }); } public static IPromise Sleep(int timeout) { return AsyncPool.Invoke((ct) => { ct.CancellationRequested(ct.CancelOperation); Thread.Sleep(timeout); return 0; }); } } }