comparison Implab/PromiseAwaiter.cs @ 192:f1da3afc3521 release v2.1

Слияние с v2
author cin
date Fri, 22 Apr 2016 13:10:34 +0300
parents ec91a6dfa5b3
children cbe10ac0731e
comparison
equal deleted inserted replaced
71:1714fd8678ef 192:f1da3afc3521
1 using System;
2 using System.Runtime.CompilerServices;
3
4 namespace Implab {
5 public struct PromiseAwaiter : INotifyCompletion {
6 readonly IPromise m_promise;
7
8 public PromiseAwaiter(IPromise promise) {
9 m_promise = promise;
10 }
11
12 public void OnCompleted (Action continuation) {
13 if (m_promise != null)
14 m_promise.On(continuation, PromiseEventType.All);
15 }
16
17 public void GetResult() {
18 m_promise.Join();
19 }
20
21 public bool IsCompleted {
22 get {
23 return m_promise.IsResolved;
24 }
25 }
26 }
27 }
28