public void OnSuccess(R item) { DisposableHelper.WeakDispose(ref upstream); value = item; Volatile.Write(ref state, 1); parent.Drain(); }
public void OnSuccess(T item) { DisposableHelper.WeakDispose(ref upstream); value = item; error = ExceptionHelper.TERMINATED; Unblock(); }
internal override void Drain() { if (Interlocked.Increment(ref wip) == 1) { for (; ;) { if (DisposableHelper.IsDisposed(ref upstream)) { Interlocked.Exchange(ref sources, null)?.Dispose(); } else { var hasNext = false; var next = default(ICompletableSource); try { if (sources.MoveNext()) { hasNext = true; next = RequireNonNullRef(sources.Current, "The enumerator returned a null ICompletableSource"); } } catch (Exception ex) { DisposableHelper.WeakDispose(ref upstream); ExceptionHelper.AddException(ref errors, ex); ex = Volatile.Read(ref errors); downstream.OnError(ex); continue; } if (hasNext) { next.Subscribe(this); } else { DisposableHelper.WeakDispose(ref upstream); var ex = Volatile.Read(ref errors); if (ex != null) { downstream.OnError(ex); } else { downstream.OnCompleted(); } continue; } } if (Interlocked.Decrement(ref wip) == 0) { break; } } } }
public void OnCompleted() { if (upstream != DisposableHelper.DISPOSED) { DisposableHelper.WeakDispose(ref upstream); downstream.OnCompleted(); } }
public override void OnError(Exception error) { DisposableHelper.WeakDispose(ref upstream); HalfSerializer.OnError(downstream, error, ref halfSerializer, ref this.error); redoObserver.Dispose(); }
public void OnError(Exception ex) { if (upstream != DisposableHelper.DISPOSED) { DisposableHelper.WeakDispose(ref upstream); downstream.OnError(ex); } }
internal void Next() { if (Interlocked.Increment(ref wip) == 1) { for (; ;) { if (DisposableHelper.IsDisposed(ref upstream)) { sources?.Dispose(); sources = null; } else { var b = false; var src = default(IObservableSource <T>); try { b = sources.MoveNext(); if (b) { src = ValidationHelper.RequireNonNullRef(sources.Current, "The enumerator returned a null IObservableSource"); } } catch (Exception ex) { DisposableHelper.WeakDispose(ref upstream); downstream.OnError(ex); continue; } if (b) { src.Subscribe(this); } else { DisposableHelper.WeakDispose(ref upstream); var ex = Volatile.Read(ref errors); if (ex != null) { downstream.OnError(ex); } else { downstream.OnCompleted(); } continue; } } if (Interlocked.Decrement(ref wip) == 0) { break; } } } }
public override void OnSuccess(T item) { DisposableHelper.WeakDispose(ref upstream); redoObserver.Dispose(); if (Interlocked.CompareExchange(ref halfSerializer, 1, 0) == 0) { downstream.OnSuccess(item); } }
public void OnCompleted() { DisposableHelper.WeakDispose(ref upstream); try { onCompleted?.Invoke(); } catch (Exception) { // FIXME nowhere to put these } }
public void OnError(Exception error) { DisposableHelper.WeakDispose(ref upstream); try { onError?.Invoke(error); } catch (Exception) { // FIXME nowhere to put these } }
public void OnSuccess(T item) { DisposableHelper.WeakDispose(ref upstream); try { onSuccess?.Invoke(item); } catch (Exception) { // FIXME nowhere to put these } }
public void OnError(Exception error) { if (delayErrors) { ExceptionHelper.AddException(ref this.errors, error); } else { DisposableHelper.WeakDispose(ref upstream); downstream.OnError(error); } Drain(); }
public void OnCompleted() { var p = Volatile.Read(ref parent); if (p != null) { var src = source; parent = null; source = null; DisposableHelper.WeakDispose(ref upstream); src.Subscribe(p); } }
public void OnCompleted() { if (Interlocked.CompareExchange(ref once, 1, 0) == 0) { foreach (var inner in Interlocked.Exchange(ref observers, TERMINATED)) { if (!inner.IsDisposed()) { inner.dowstream.OnCompleted(); } } DisposableHelper.WeakDispose(ref upstream); } }
public void OnCompleted() { if (!DisposableHelper.IsDisposed(ref upstream)) { DisposableHelper.WeakDispose(ref upstream); try { onCompleted?.Invoke(); } catch (Exception) { // TODO where to put these? } } }
public void OnError(Exception error) { if (Interlocked.CompareExchange(ref once, 1, 0) == 0) { this.error = error; foreach (var inner in Interlocked.Exchange(ref observers, TERMINATED)) { if (!inner.IsDisposed()) { inner.dowstream.OnError(error); } } DisposableHelper.WeakDispose(ref upstream); } }
public void OnError(Exception ex) { if (!DisposableHelper.IsDisposed(ref upstream)) { DisposableHelper.WeakDispose(ref upstream); try { onError?.Invoke(ex); } catch (Exception) { // TODO where to put these? } } }
public void OnSuccess(T item) { if (Interlocked.CompareExchange(ref once, 1, 0) == 0) { value = item; foreach (var inner in Interlocked.Exchange(ref observers, TERMINATED)) { if (!inner.IsDisposed()) { inner.dowstream.OnSuccess(item); } } DisposableHelper.WeakDispose(ref upstream); } }
internal void Drain(IMaybeSource <T> source) { if (Interlocked.Increment(ref wip) == 1) { for (; ;) { if (!DisposableHelper.IsDisposed(ref upstream)) { if (source != null) { source.Subscribe(this); source = null; } else { var idx = index; if (idx == fallbacks.Length) { DisposableHelper.WeakDispose(ref upstream); downstream.OnCompleted(); } else { var src = fallbacks[idx]; if (src == null) { DisposableHelper.WeakDispose(ref upstream); downstream.OnError(new NullReferenceException("The fallback IMaybeSource at index " + idx + " is null")); } else { index = idx + 1; src.Subscribe(this); } } } } if (Interlocked.Decrement(ref wip) == 0) { break; } } } }
public override void OnSuccess(T item) { DisposableHelper.WeakDispose(ref upstream); var source = default(ISingleSource <R>); try { source = RequireNonNullRef(mapper(item), "The mapper returned a null ISingleSource"); } catch (Exception ex) { downstream.OnError(ex); return; } source.Subscribe(inner); }
public bool SubscribeTo(IMaybeSource <T> source) { var inner = new InnerObserver(this); observers.Enqueue(inner); if (Volatile.Read(ref disposed)) { DisposableHelper.WeakDispose(ref inner.upstream); Cleanup(); return(false); } if (source == null) { InnerError(inner, new NullReferenceException("The IMaybeSource is null")); return(true); } source.Subscribe(inner); return(true); }
public void OnCompleted() { DisposableHelper.WeakDispose(ref upstream); parent.InnerCompleted(index); }
public void OnError(Exception error) { DisposableHelper.WeakDispose(ref upstream); parent.InnerError(index, error); }
public void OnSuccess(T item) { DisposableHelper.WeakDispose(ref upstream); parent.InnerSuccess(index, item); }
public void OnError(Exception error) { DisposableHelper.WeakDispose(ref upstream); this.error = error; Unblock(); }
public void OnCompleted() { DisposableHelper.WeakDispose(ref upstream); error = ExceptionHelper.TERMINATED; Unblock(); }
internal override void Drain() { if (Interlocked.Increment(ref wip) == 1) { for (; ;) { var srcs = sources; var n = srcs.Length; if (DisposableHelper.IsDisposed(ref upstream)) { for (int i = index; i < n; i++) { srcs[i] = null; } } else { var i = index; if (i == n) { DisposableHelper.WeakDispose(ref upstream); var ex = Volatile.Read(ref errors); if (ex != null) { downstream.OnError(ex); } else { downstream.OnCompleted(); } } else { var src = srcs[i]; if (src == null) { DisposableHelper.WeakDispose(ref upstream); ExceptionHelper.AddException(ref errors, new NullReferenceException("The " + i + "th ICompletableSource is null")); var ex = Volatile.Read(ref errors); downstream.OnError(ex); continue; } else { srcs[i] = null; index = i + 1; src.Subscribe(this); } } } if (Interlocked.Decrement(ref wip) == 0) { break; } } } }
public void OnError(Exception error) { DisposableHelper.WeakDispose(ref upstream); downstream.OnError(error); }
public void OnCompleted() { DisposableHelper.WeakDispose(ref upstream); downstream.OnCompleted(); }
public void OnSuccess(T item) { DisposableHelper.WeakDispose(ref upstream); downstream.OnNext(item); downstream.OnCompleted(); }