Mercurial > pub > ImplabNet
annotate Implab/Promise.cs @ 162:0526412bbb26 ref20160224
DFA refactoring
author | cin |
---|---|
date | Wed, 24 Feb 2016 08:39:53 +0300 |
parents | 8c0b95069066 |
children | 8200ab154c8a |
rev | line source |
---|---|
119
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
112
diff
changeset
|
1 using System; |
144 | 2 using Implab.Parallels; |
119
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
112
diff
changeset
|
3 |
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
112
diff
changeset
|
4 namespace Implab { |
144 | 5 public class Promise : AbstractPromise, IDeferred { |
6 public static readonly Promise SUCCESS; | |
119
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
112
diff
changeset
|
7 |
144 | 8 static Promise() { |
9 SUCCESS = new Promise(); | |
10 SUCCESS.Resolve(); | |
119
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
112
diff
changeset
|
11 } |
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
112
diff
changeset
|
12 |
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
112
diff
changeset
|
13 public void Resolve() { |
144 | 14 SetResult(); |
119
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
112
diff
changeset
|
15 } |
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
112
diff
changeset
|
16 |
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
112
diff
changeset
|
17 public void Reject(Exception error) { |
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
112
diff
changeset
|
18 SetError(error); |
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
112
diff
changeset
|
19 } |
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
112
diff
changeset
|
20 } |
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
112
diff
changeset
|
21 } |
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
112
diff
changeset
|
22 |