Пример #1
0
        partial void CancelProgressListeners()
        {
            // TODO: this algorithm is O(n^3), refactor progress to reduce runtime costs of cancelations.
            InternalProtected.UnsignedFixed32 progress = _waitDepthAndProgress.GetIncrementedWholeTruncated();
            while (_progressListeners.IsNotEmpty)
            {
                var listener = _progressListeners.Pop();
                listener.CancelOrSetProgress(this, progress);

#if CSHARP_7_OR_LATER
                object previous = _valueOrPrevious;
                while (previous is Promise promise)
                {
                    promise._progressListeners.Remove(listener);
                    listener.CancelOrSetProgress(promise, progress);
                    previous = promise._valueOrPrevious;
                }
#else
                Promise promise = _valueOrPrevious as Promise;
                while (promise != null)
                {
                    promise._progressListeners.Remove(listener);
                    listener.CancelOrSetProgress(promise, progress);
                    promise = promise._valueOrPrevious as Promise;
                }
#endif
            }
        }
Пример #2
0
 partial void ResolveProgressListeners()
 {
     InternalProtected.UnsignedFixed32 progress = _waitDepthAndProgress.GetIncrementedWholeTruncated();
     while (_progressListeners.IsNotEmpty)
     {
         _progressListeners.Pop().ResolveOrSetProgress(this, progress);
     }
 }
Пример #3
0
 protected virtual void SetDepth(InternalProtected.UnsignedFixed32 previousDepth)
 {
     _waitDepthAndProgress = previousDepth;
 }
Пример #4
0
 partial void ResetDepth()
 {
     _waitDepthAndProgress = default(InternalProtected.UnsignedFixed32);
 }