Mercurial > pub > ImplabNet
view Implab/FuncTask.cs @ 246:5aa9cfbe56c3 v3
missing files
author | cin |
---|---|
date | Fri, 26 Jan 2018 11:19:38 +0300 |
parents | eee3e49dd1ff |
children |
line wrap: on
line source
using System; using System.Threading; namespace Implab { public class FuncTask<T> : FuncTaskBase<T>, IResolvable { readonly Func<T> m_task; public FuncTask(Func<T> task, Func<Exception, T> error, Func<Exception, T> 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) { SetErrorInternal(err); } } } } }