public void OnError(Exception error) { var inner = new MaybeInnerObserver <T>(downstream); if (Interlocked.CompareExchange(ref fallbackObserver, inner, null) == null) { var fb = fallback; fallback = null; fb.Subscribe(inner); } }
void Next() { var o = main; main = null; var inner = new MaybeInnerObserver <T>(downstream); if (DisposableHelper.Replace(ref upstream, inner)) { o.Subscribe(inner); } }
public void OnError(Exception error) { var fb = default(IMaybeSource <T>); try { fb = RequireNonNullRef(handler(error), "The handler returned a null IMaybeSource"); } catch (Exception ex) { downstream.OnError(new AggregateException(error, ex)); return; } var inner = new MaybeInnerObserver <T>(downstream); if (Interlocked.CompareExchange(ref fallbackObserver, inner, null) == null) { fb.Subscribe(inner); } }
internal void Run() { if (Interlocked.CompareExchange(ref exclude, 1, 0) == 0) { DisposableHelper.Dispose(ref upstream); var c = fallback; if (c == null) { downstream.OnError(new TimeoutException()); } else { fallback = null; var inner = new MaybeInnerObserver <T>(downstream); if (Interlocked.CompareExchange(ref fallbackObserver, inner, null) == null) { c.Subscribe(inner); } } } }