internal CompletableRedoWhenObserver(ICompletableObserver downstream, ICompletableSource source, IObserver <X> errorSignal) { this.downstream = downstream; this.source = source; this.terminalSignal = errorSignal; this.handlerObserver = new HandlerObserver(this); }
internal static ICompletableSource Create(ICompletableSource source, Action onCompleted = null, Action <Exception> onError = null, Action <IDisposable> onSubscribe = null, Action onTerminate = null, Action onAfterTerminate = null, Action onDispose = null, Action doFinally = null ) { if (source is CompletablePeek p) { return(new CompletablePeek(p.source, Combine(p.onCompleted, onCompleted), Combine(p.onError, onError), Combine(p.onSubscribe, onSubscribe), Combine(p.onTerminate, onTerminate), Combine(p.onAfterTerminate, onAfterTerminate), Combine(p.onDispose, onDispose), Combine(p.doFinally, doFinally) )); } return(new CompletablePeek(source, onCompleted, onError, onSubscribe, onTerminate, onAfterTerminate, onDispose, doFinally )); }
public void Subscribe(ICompletableObserver observer) { var srcs = sources; var n = 0; var o = new ICompletableSource[8]; try { foreach (var s in srcs) { if (n == o.Length) { var b = new ICompletableSource[n + (n >> 2)]; Array.Copy(o, 0, b, 0, n); o = b; } o[n++] = s; } } catch (Exception ex) { DisposableHelper.Error(observer, ex); return; } CompletableAmb.Subscribe(observer, o, n); }
public CompletableTimeout(ICompletableSource source, TimeSpan timeout, IScheduler scheduler, ICompletableSource fallback) { this.source = source; this.timeout = timeout; this.scheduler = scheduler; this.fallback = fallback; }
internal void Run() { var o = other; other = null; o.Subscribe(this); }
public void OnError(Exception error) { var inner = new CompletableInnerObserver(downstream); if (Interlocked.CompareExchange(ref fallbackObserver, inner, null) == null) { var fb = fallback; fallback = null; fb.Subscribe(inner); } }
public void OnCompleted() { if (other == null) { downstream.OnCompleted(); } else { var o = other; other = null; o.Subscribe(this); } }
public void OnCompleted() { if (next == null) { downstream.OnCompleted(); Dispose(); } else { if (DisposableHelper.Replace(ref upstream, null)) { var src = next; next = null; src.Subscribe(this); } } }
public CompletablePeek( ICompletableSource source, Action onCompleted, Action <Exception> onError, Action <IDisposable> onSubscribe, Action onTerminate, Action onAfterTerminate, Action onDispose, Action doFinally) { this.source = source; this.onCompleted = onCompleted; this.onError = onError; this.onSubscribe = onSubscribe; this.onTerminate = onTerminate; this.onAfterTerminate = onAfterTerminate; this.onDispose = onDispose; this.doFinally = doFinally; }
internal void Run() { for (; ;) { var d = Volatile.Read(ref task); if (d == DisposableHelper.DISPOSED) { break; } if (Interlocked.CompareExchange(ref task, DisposableHelper.EMPTY, d) == d) { var s = source; source = null; s.Subscribe(this); break; } } }
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 CompletableInnerObserver(downstream); if (Interlocked.CompareExchange(ref fallbackObserver, inner, null) == null) { c.Subscribe(inner); } } } }
internal CompletableRepeatWhen(ICompletableSource source, Func <IObservable <object>, IObservable <U> > handler) { this.source = source; this.handler = handler; }
public void OnError(Exception error) { other = null; downstream.OnError(error); }
public DelaySubscriptionObserver(ICompletableObserver downstream, ICompletableSource other) { this.downstream = downstream; this.other = other; }
public CompletableDelaySubscriptionTime(ICompletableSource source, TimeSpan delay, IScheduler scheduler) { this.source = source; this.delay = delay; this.scheduler = scheduler; }
public RepeatObserver(ICompletableObserver downstream, ICompletableSource source, Func <Exception, long, bool> predicate) : base(downstream, source) { this.predicate = predicate; }
public CompletableDelaySubscription(ICompletableSource source, ICompletableSource other) { this.source = source; this.other = other; }
public CompletableCache(ICompletableSource source, Action <IDisposable> cancel) { this.source = source; this.cancel = cancel; Volatile.Write(ref observers, EMPTY); }
public CompletableTakeUntilObservable(ICompletableSource source, IObservable <U> other) { this.source = source; this.other = other; }
internal MainObserver(ICompletableObserver downstream, ICompletableSource source, IObserver <object> errorSignal) : base(downstream, source, errorSignal) { }
public AndThenObserver(ICompletableObserver downstream, ICompletableSource next) { this.downstream = downstream; Volatile.Write(ref this.next, next); }
public CompletableAndThenSingle(ICompletableSource source, ISingleSource <T> next) { this.source = source; this.next = next; }
public CompletableAndThenMaybe(ICompletableSource source, IMaybeSource <T> next) { this.source = source; this.next = next; }
public CompletableAndThen(ICompletableSource source, ICompletableSource next) { this.source = source; this.next = next; }
public CompletableOnTerminateDetach(ICompletableSource source) { this.source = source; }
public void OnError(Exception error) { next = null; downstream.OnError(error); }
public CompletableRedoObserver(ICompletableObserver downstream, ICompletableSource source) { this.downstream = downstream; this.source = source; }
public CompletableAndThenObservable(ICompletableSource source, IObservable <T> next) { this.source = source; this.next = next; }
public CompletableTakeUntil(ICompletableSource source, ICompletableSource other) { this.source = source; this.other = other; }
public CompletableToSingle(ICompletableSource source, T item) { this.source = source; this.item = item; }