Browse Source

Merge pull request #758 from danielcweber/SaveStaticPerGenericClassField

Save one static per-generic-class field.
Daniel C. Weber 7 years ago
parent
commit
064b8651b1
1 changed files with 2 additions and 3 deletions
  1. 2 3
      Rx.NET/Source/src/System.Reactive/Linq/Observable/RetryWhen.cs

+ 2 - 3
Rx.NET/Source/src/System.Reactive/Linq/Observable/RetryWhen.cs

@@ -161,7 +161,6 @@ namespace System.Reactive.Linq.ObservableImpl
         private readonly IObserver<X> _downstream;
         private int _wip;
         private Exception _terminalException;
-        private static readonly Exception DoneIndicator = new Exception();
         private static readonly Exception SignaledIndicator = new Exception();
         private readonly ConcurrentQueue<X> _queue;
 
@@ -173,7 +172,7 @@ namespace System.Reactive.Linq.ObservableImpl
 
         public void OnCompleted()
         {
-            if (Interlocked.CompareExchange(ref _terminalException, DoneIndicator, null) == null)
+            if (Interlocked.CompareExchange(ref _terminalException, ExceptionHelper.Terminated, null) == null)
             {
                 Drain();
             }
@@ -218,7 +217,7 @@ namespace System.Reactive.Linq.ObservableImpl
                     if (ex != SignaledIndicator)
                     {
                         Interlocked.Exchange(ref _terminalException, SignaledIndicator);
-                        if (ex != DoneIndicator)
+                        if (ex != ExceptionHelper.Terminated)
                         {
                             _downstream.OnError(ex);
                         }