##// END OF EJS Templates
Слияние с ref20160224
Слияние с ref20160224

File last commit:

r187:dd4a3590f9c6 ref20160224
r190:1c2a16d071a7 merge 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);
}
}
}
}
}