Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions Rx.NET/Source/src/System.Reactive/Linq/Observable/Zip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -551,21 +551,18 @@ public Zip(IEnumerable<IObservable<TSource>> sources)
_sources = sources;
}

protected override _ CreateSink(IObserver<IList<TSource>> observer) => new _(this, observer);
protected override _ CreateSink(IObserver<IList<TSource>> observer) => new _(observer);

protected override void Run(_ sink) => sink.Run();
protected override void Run(_ sink) => sink.Run(_sources);

internal sealed class _ : IdentitySink<IList<TSource>>
{
private readonly Zip<TSource> _parent;

private readonly object _gate;

public _(Zip<TSource> parent, IObserver<IList<TSource>> observer)
public _(IObserver<IList<TSource>> observer)
: base(observer)
{
_gate = new object();
_parent = parent;
}

private Queue<TSource>[] _queues;
Expand All @@ -574,9 +571,9 @@ public _(Zip<TSource> parent, IObserver<IList<TSource>> observer)

private static readonly IDisposable[] Disposed = new IDisposable[0];

public void Run()
public void Run(IEnumerable<IObservable<TSource>> sources)
{
var srcs = _parent._sources.ToArray();
var srcs = sources.ToArray();

var N = srcs.Length;

Expand Down