protected override bool SubscribeProgressAndContinueLoop(ref IProgressListener progressListener, out Promise previous) { // This is guaranteed to be pending. bool firstSubscribe = _progressListeners.IsEmpty; progressListener.Retain(); _progressListeners.Push(progressListener); previous = _valueOrPrevious as Promise; if (_secondPrevious) { if (!firstSubscribe) { return(false); } // Subscribe this to the returned promise. progressListener = this; } return(previous != null); }