internal void SubscribeFirst(IPublisher <U> p) { var to = new PublisherTimeoutSelectorTimeout <U>(this, 0L); d = to; p.Subscribe(to); }
public void OnNext(T t) { d?.Dispose(); long idx = localIndex; if (Interlocked.Increment(ref sharedIndex) == idx) { localIndex = idx + 1; actual.OnNext(t); arbiter.Produced(1); IPublisher <V> p; try { p = itemDelay(t); } catch (Exception e) { localIndex = long.MaxValue; arbiter.Cancel(); actual.OnError(e); return; } if (p == null) { localIndex = long.MaxValue; arbiter.Cancel(); actual.OnError(new NullReferenceException("The itemDelay returned a null value")); return; } var to = new PublisherTimeoutSelectorTimeout <V>(this, idx); d = to; p.Subscribe(to); } }