using System; using System.Threading; 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() { if (m_task != null && LockCancelation()) { try { SetResult(m_task()); } catch(Exception err) { HandleErrorInternal(err); } } } } }