internal void SetNext(IDisposable next) { if (next != DisposableHelper.EMPTY) { DisposableHelper.Replace(ref this.next, next); } }
IDisposable Timeout(long idx) { if (Volatile.Read(ref index) == idx && Interlocked.CompareExchange(ref index, long.MaxValue, idx) == idx) { DisposableHelper.Dispose(ref upstream); var src = fallback; fallback = null; if (src != null) { var fo = new FallbackObserver(downstream); if (DisposableHelper.Replace(ref other, fo)) { src.Subscribe(fo); } } else { downstream.OnError(new TimeoutException($"Timeout at index " + idx)); } } return(DisposableHelper.EMPTY); }
public void OnCompleted() { if (DisposableHelper.Replace(ref upstream, null)) { var src = next; next = null; src.Subscribe(this); } }
public void OnSubscribe(IDisposable d) { if (DisposableHelper.Replace(ref upstream, d)) { if (!once) { downstream.OnSubscribe(this); } } }
void Next() { var o = main; main = null; var inner = new MaybeInnerObserver <T>(downstream); if (DisposableHelper.Replace(ref upstream, inner)) { o.Subscribe(inner); } }
void Drain() { if (Interlocked.Increment(ref wip) == 1) { var sad = new SingleAssignmentDisposable(); if (DisposableHelper.Replace(ref task, sad)) { sad.Disposable = scheduler.Schedule(this, (sch, @this) => { return(@this.Run(sch)); }); } } }
public void OnCompleted() { if (next == null) { downstream.OnCompleted(); Dispose(); } else { if (DisposableHelper.Replace(ref upstream, null)) { var src = next; next = null; DisposableHelper.Replace(ref upstream, src.Subscribe(this)); } } }
public void OnSuccess(T item) { var src = default(IObservable <R>); try { src = RequireNonNullRef(mapper(item), "The mapper returned a null IObservable"); } catch (Exception ex) { OnError(ex); return; } var d = src.Subscribe(this); DisposableHelper.Replace(ref upstream, d); }
internal void Next() { if (Interlocked.Increment(ref wip) != 1) { return; } for (; ;) { if (DisposableHelper.Replace(ref upstream, null)) { source.Subscribe(this); } if (Interlocked.Decrement(ref wip) == 0) { break; } } }
internal void StartTimer(long idx) { var d = scheduler.Schedule((@this: this, idx), timeout, (_, state) => [email protected](idx)); DisposableHelper.Replace(ref timer, d); }
internal void SetTask(IDisposable d) { DisposableHelper.Replace(ref task, d); }
public void OnSubscribe(IDisposable d) { DisposableHelper.Replace(ref upstream, d); }
public void SetTask(IDisposable d) { DisposableHelper.Replace(ref task, d); }