internal override void BackUp(CompletesContinuation continuation) { if (continuation != null) { _continuationsBackup.Enqueue(continuation); } }
internal void AndThenInternal(CompletesContinuation continuation) { RegisterContinuation(continuation); if (ReadyToExectue.Get()) { RunContinuationsWhenReady(); } }
internal void OtherwiseInternal(BasicCompletes continuationCompletes) { var continuation = new CompletesContinuation(continuationCompletes); RegisterFailureContinuation(continuation); if (OutcomeKnown.IsSet && HasFailedValue.Get()) { continuation.Run(this); } }
private void RegisterContinuation(CompletesContinuation continuationCompletes) { if (HasException.Get()) { var currentContinuations = new CompletesContinuation[Continuations.Count]; Continuations.CopyTo(currentContinuations, 0); var continuationsCount = Continuations.Count; for (var i = 0; i < continuationsCount; i++) { Continuations.TryDequeue(out _); } Continuations.Enqueue(continuationCompletes); foreach (var currentContinuation in currentContinuations) { Continuations.Enqueue(currentContinuation); } } else { Continuations.Enqueue(continuationCompletes); } }
private void RegisterFailureContinuation(CompletesContinuation continuationCompletes) => FailureContinuation = continuationCompletes;
private void RegisterContinuation(CompletesContinuation continuationCompletes) => Continuations.Enqueue(continuationCompletes);
internal void RecoverInternal(BasicCompletes continuationCompletes) { var continuation = new CompletesContinuation(continuationCompletes); RegisterExceptionContinuation(continuation); }
internal void AndThenInternal(BasicCompletes continuationCompletes) { var continuation = new CompletesContinuation(continuationCompletes); AndThenInternal(continuation); }
internal abstract void BackUp(CompletesContinuation continuation);
private void RegisterExceptionContinuation(CompletesContinuation continuationCompletes) => ExceptionContinuation = continuationCompletes;
internal void OtherwiseInternal(BasicCompletes continuationCompletes) { var continuation = new CompletesContinuation(continuationCompletes); RegisterFailureContinuation(continuation); }