Mercurial > pub > ImplabNet
view Implab/PromiseAwaiterT.cs @ 212:a01d9df88d74 v2
Added class Trace<T> to manage channels for individual classes, if SomeClass
uses Trace<SomeClass> it sould be marked with TraceSourceAttribute
author | cin |
---|---|
date | Tue, 04 Apr 2017 12:04:05 +0300 |
parents | ec91a6dfa5b3 |
children | cbe10ac0731e |
line wrap: on
line source
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; } } } }