##// END OF EJS Templates
sync
sync

File last commit:

r149:eb793fbbe4ea v2
r166:b84cdbe82e7f ref20160224
Show More
ActionChainTask.cs
25 lines | 776 B | text/x-csharp | CSharpLexer
using System;
namespace Implab {
public class ActionChainTask : ActionChainTaskBase, IDeferred {
readonly Func<IPromise> m_task;
public ActionChainTask(Func<IPromise> task, Func<Exception, IPromise> error, Func<Exception, IPromise> cancel, bool autoCancellable) : base(error,cancel, autoCancellable) {
m_task = task;
}
public void Resolve() {
if (m_task != null && LockCancelation()) {
try {
var p = m_task();
p.On(SetResult, HandleErrorInternal, SetCancelled);
CancellationRequested(p.Cancel);
} catch(Exception err) {
HandleErrorInternal(err);
}
}
}
}
}