using System; namespace Implab { public class FuncTask : FuncTaskBase, IDeferred { readonly Func m_task; public FuncTask(Func task, Func error,Func 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(Exception err) { SetErrorInternal(err); } } } } }