Skip to content

Commit

Permalink
Merge pull request #758 from danielcweber/SaveStaticPerGenericClassField
Browse files Browse the repository at this point in the history
Save one static per-generic-class field.
  • Loading branch information
danielcweber authored Jul 4, 2018
2 parents fcd8d27 + d011957 commit 064b865
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ internal sealed class RedoSerializedObserver<X> : IObserver<X>
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;

Expand All @@ -173,7 +172,7 @@ internal RedoSerializedObserver(IObserver<X> downstream)

public void OnCompleted()
{
if (Interlocked.CompareExchange(ref _terminalException, DoneIndicator, null) == null)
if (Interlocked.CompareExchange(ref _terminalException, ExceptionHelper.Terminated, null) == null)
{
Drain();
}
Expand Down Expand Up @@ -218,7 +217,7 @@ private void Drain()
if (ex != SignaledIndicator)
{
Interlocked.Exchange(ref _terminalException, SignaledIndicator);
if (ex != DoneIndicator)
if (ex != ExceptionHelper.Terminated)
{
_downstream.OnError(ex);
}
Expand Down

0 comments on commit 064b865

Please sign in to comment.