##// END OF EJS Templates
Working on Implab.Diagnostics
Working on Implab.Diagnostics

File last commit:

r249:d82909310094 v3
r286:67ebcfd7d1c8 v3
Show More
PromiseHelper.cs
40 lines | 1.1 KiB | text/x-csharp | CSharpLexer
cin
Implab.Test moved to xunit...
r249 using Implab;
using System;
cin
implemeted new cancellable promises concept
r10 using System.Threading;
namespace Implab.Test {
cin
ported tests to mono
r77 static class PromiseHelper {
cin
Implab.Test moved to xunit...
r249 public static IPromise<T> Sleep<T>(int timeout, T retVal, CancellationToken ct = default(CancellationToken)) {
Timer timer = null;
return Promise.Create<T>((d) => {
timer = new Timer(x => {
d.Resolve(retVal);
}, null, timeout, Timeout.Infinite);
if(ct.CanBeCanceled)
ct.Register(d.Cancel);
}).Finally(() => {
Safe.Dispose(timer);
cin
implemeted new cancellable promises concept
r10 });
}
cin
Added 'Fail' method to RunnableComponent which allows component to move from...
r203
cin
Implab.Test moved to xunit...
r249 public static IPromise Sleep(int timeout, CancellationToken ct = default(CancellationToken)) {
Timer timer = null;
return Promise.Create((d) => {
timer = new Timer(x => {
d.Resolve();
}, null, timeout, Timeout.Infinite);
if(ct.CanBeCanceled)
ct.Register(d.Cancel);
}).Finally(() => {
Safe.Dispose(timer);
cin
Added 'Fail' method to RunnableComponent which allows component to move from...
r203 });
}
cin
implemeted new cancellable promises concept
r10 }
}