internal void DoSuccess() { using (spinLock.Hold()) { if (status != WaitableStatus.Running) { return; } status = WaitableStatus.Success; } foreach (var callback in successCallbacks) { callback(); } Dispose(); }
protected void Fail(Exception e) { using (spinLock.Hold()) { if (status != WaitableStatus.Running) { return; } Exception = e; status = WaitableStatus.Error; } foreach (var callback in catchCallbacks) { callback(e); } Dispose(); }
private protected void Success() { using (spin.Hold()) { if (status != WaitableStatus.Running) { return; } status = WaitableStatus.Success; } var actions = successCallbacks; Dispose(); foreach (var callback in actions) { callback(); } }
public void Abort(bool recursive = true) { using (spinLock.Hold()) { if (status != WaitableStatus.Running) { return; } Exception = null; status = WaitableStatus.Abort; } OnAbort(recursive); foreach (var callback in catchCallbacks) { callback(Exception); } Dispose(); }
private protected void Fail(Exception e) { using (spin.Hold()) { if (status != WaitableStatus.Running) { return; } Exception = e; status = WaitableStatus.Error; } var actions = failCallbacks; Dispose(); foreach (var callback in actions) { callback(e); } }
public void Abort() { using (spin.Hold()) { if (status != WaitableStatus.Running) { return; } Exception = null; status = WaitableStatus.Abort; } OnAbort(); var actions = failCallbacks; Dispose(); foreach (var callback in actions) { callback(null); } }
protected Waitable() { id = IdGenerator.Next(); status = WaitableStatus.Running; }