ActionTask.cs
22 lines
| 588 B
| text/x-csharp
|
CSharpLexer
/ Implab / ActionTask.cs
cin
|
r145 | using System; | ||
namespace Implab { | ||||
public class ActionTask : ActionTaskBase, IDeferred { | ||||
readonly Action m_task; | ||||
public ActionTask(Action task, Action<Exception> error, Action<Exception> cancel) : base(error,cancel) { | ||||
m_task = task; | ||||
} | ||||
public void Resolve() { | ||||
if (m_task != null && LockCancelation()) { | ||||
try { | ||||
m_task(); | ||||
SetResult(); | ||||
} catch(Exception err) { | ||||
HandleErrorInternal(err); | ||||
} | ||||
} | ||||
} | ||||
} | ||||
} | ||||