##// END OF EJS Templates
Working on promises
Working on promises

File last commit:

r242:cbe10ac0731e v3
r242:cbe10ac0731e v3
Show More
PromiseAwaiterT.cs
28 lines | 650 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 {
cin
Working on promises
r242 return m_promise.IsFulfilled;
cin
Added support for 'await' operator to promises
r151 }
}
}
}