view Implab.Test/PromiseHelper.cs @ 193:0d69c0d6de0d

Added tag release v2.1 for changeset f1da3afc3521
author cin
date Fri, 22 Apr 2016 13:13:08 +0300
parents eb793fbbe4ea
children 4d9830a9bbb8
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;
            });
        }
    }
}