Promise.cs
22 lines
| 434 B
| text/x-csharp
|
CSharpLexer
/ Implab / Promise.cs
|
|
r119 | using System; | ||
|
|
r144 | using Implab.Parallels; | ||
|
|
r119 | |||
| namespace Implab { | ||||
|
|
r144 | public class Promise : AbstractPromise, IDeferred { | ||
| public static readonly Promise SUCCESS; | ||||
|
|
r119 | |||
|
|
r144 | static Promise() { | ||
| SUCCESS = new Promise(); | ||||
| SUCCESS.Resolve(); | ||||
|
|
r119 | } | ||
| public void Resolve() { | ||||
|
|
r144 | SetResult(); | ||
|
|
r119 | } | ||
| public void Reject(Exception error) { | ||||
| SetError(error); | ||||
| } | ||||
| } | ||||
| } | ||||
