##// END OF EJS Templates
working on diagnostics
working on diagnostics

File last commit:

r187:dd4a3590f9c6 ref20160224
r194:d45bdf510514 v2
Show More
FuncTaskT.cs
24 lines | 797 B | text/x-csharp | CSharpLexer
using System;
namespace Implab {
public class FuncTask<TArg, TResult> : FuncTaskBase<TResult>, IDeferred<TArg> {
readonly Func<TArg, TResult> m_task;
public FuncTask(Func<TArg, TResult> task, Func<Exception, TResult> error,Func<Exception, TResult> cancel, bool autoCancellable) : base(error,cancel, autoCancellable) {
m_task = task;
}
public void Resolve(TArg value) {
if (m_task != null && LockCancelation()) {
try {
SetResult(m_task(value));
} catch(OperationCanceledException reason) {
HandleCancelInternal(reason);
} catch(Exception err) {
HandleErrorInternal(err);
}
}
}
}
}