##// END OF EJS Templates
RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)...
RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool) IRunnable is now disposable Code cleanups, suppressed some CodeAnalysis warnings

File last commit:

r203:4d9830a9bbb8 v2
r208:7d07503621fe v2
Show More
PromiseHelper.cs
22 lines | 663 B | text/x-csharp | CSharpLexer
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;
});
}
}
}