|
|
@@ -3,6 +3,7 @@
|
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
|
|
using System.Reactive.Concurrency;
|
|
|
+using System.Reactive.Disposables;
|
|
|
|
|
|
namespace System.Reactive.Linq.ObservableImpl
|
|
|
{
|
|
|
@@ -28,13 +29,25 @@ namespace System.Reactive.Linq.ObservableImpl
|
|
|
|
|
|
public IDisposable Run(IScheduler scheduler)
|
|
|
{
|
|
|
- return scheduler.Schedule(Invoke);
|
|
|
+ return scheduler.Schedule(this, (s, target) =>
|
|
|
+ {
|
|
|
+ target.OnCompleted();
|
|
|
+ return Disposable.Empty;
|
|
|
+ });
|
|
|
}
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- private void Invoke()
|
|
|
- {
|
|
|
- ForwardOnCompleted();
|
|
|
- }
|
|
|
+ internal sealed class EmptyDirect<TResult> : BasicProducer<TResult>
|
|
|
+ {
|
|
|
+ internal static readonly IObservable<TResult> Instance = new EmptyDirect<TResult>();
|
|
|
+
|
|
|
+ private EmptyDirect() { }
|
|
|
+
|
|
|
+ protected override IDisposable Run(IObserver<TResult> observer)
|
|
|
+ {
|
|
|
+ observer.OnCompleted();
|
|
|
+ return Disposable.Empty;
|
|
|
}
|
|
|
}
|
|
|
}
|