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