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

File last commit:

r242:cbe10ac0731e v3
r245:b904e0a3ba72 v3
Show More
PromiseAwaiter.cs
28 lines | 637 B | text/x-csharp | CSharpLexer
using System;
using System.Runtime.CompilerServices;
namespace Implab {
public struct PromiseAwaiter : INotifyCompletion {
readonly IPromise m_promise;
public PromiseAwaiter(IPromise promise) {
m_promise = promise;
}
public void OnCompleted (Action continuation) {
if (m_promise != null)
m_promise.On(continuation, PromiseEventType.All);
}
public void GetResult() {
m_promise.Join();
}
public bool IsCompleted {
get {
return m_promise.IsFulfilled;
}
}
}
}