##// END OF EJS Templates
Added 'Fail' method to RunnableComponent which allows component to move from...
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.

File last commit:

r151:ec91a6dfa5b3 v2
r203:4d9830a9bbb8 v2
Show More
PromiseAwaiterT.cs
28 lines | 649 B | text/x-csharp | CSharpLexer
/ Implab / PromiseAwaiterT.cs
cin
Added support for 'await' operator to promises
r151 using System;
using System.Runtime.CompilerServices;
namespace Implab {
public struct PromiseAwaiter<T> : INotifyCompletion {
readonly IPromise<T> m_promise;
public PromiseAwaiter(IPromise<T> promise) {
m_promise = promise;
}
public void OnCompleted (Action continuation) {
if (m_promise != null)
m_promise.On(continuation, PromiseEventType.All);
}
public T GetResult() {
return m_promise.Join();
}
public bool IsCompleted {
get {
return m_promise.IsResolved;
}
}
}
}