Exemple #1
0
 public ObserveOnObserverNew(IScheduler scheduler, IObserver <T> downstream)
 {
     this.downstream = downstream;
     this.scheduler  = scheduler;
     longRunning     = scheduler.AsLongRunning();
     queue           = new ConcurrentQueue <T>();
 }
Exemple #2
0
 public _(LongRunning parent, IObserver <TSource> observer)
     : base(observer)
 {
     _source    = parent._source;
     _scheduler = parent._longRunningScheduler;
     _prepends  = parent._prepends;
     _appends   = parent._appends;
 }
Exemple #3
0
 public ObserveOnObserverNew(IScheduler scheduler, IObserver <T> downstream, IDisposable upstream)
 {
     this.downstream  = downstream;
     this.scheduler   = scheduler;
     this.longRunning = scheduler.AsLongRunning();
     this.queue       = new ConcurrentQueue <T>();
     Volatile.Write(ref this.upstream, upstream);
 }
Exemple #4
0
 public LongRunning(IObservable <TSource> source, Node <TSource> prepends, Node <TSource> appends, IScheduler scheduler, ISchedulerLongRunning longRunningScheduler)
 {
     _source               = source;
     _appends              = appends;
     _prepends             = prepends;
     Scheduler             = scheduler;
     _longRunningScheduler = longRunningScheduler;
 }
Exemple #5
0
 private Notification <TSource> _completion; // completion notification
 public LoopSubscription(IObservable <TSource> source, int maxQueueSize, ISchedulerLongRunning scheduler, IObserver <TSource> observer)
 {
     _observer = observer;
     _queue    = Queue.Create(maxQueueSize);
     scheduler.ScheduleLongRunning(_ => Loop());
     _subscription.Disposable = source.Subscribe(
         OnNext,
         error => OnCompletion(Notification.CreateOnError <TSource>(error)),
         () => OnCompletion(Notification.CreateOnCompleted <TSource>()));
 }
 private IDisposable Run(ISchedulerLongRunning scheduler)
 {
     if (_parent._repeatCount == null)
     {
         return(scheduler.ScheduleLongRunning(LoopInf));
     }
     else
     {
         return(scheduler.ScheduleLongRunning(_parent._repeatCount.Value, Loop));
     }
 }
Exemple #7
0
        public ScheduledObserver(IScheduler scheduler, IObserver <T> observer)
        {
            _scheduler   = scheduler;
            _observer    = observer;
            _longRunning = _scheduler.AsLongRunning();

            if (_longRunning != null)
            {
                _dispatcherEvent = new SemaphoreSlim(0);
            }
        }
Exemple #8
0
        public ScheduledObserver(IScheduler scheduler, IObserver <T> observer)
        {
            _scheduler   = scheduler;
            _observer    = observer;
            _longRunning = _scheduler.AsLongRunning();

            if (_longRunning != null)
            {
                _dispatcherEvent        = new SemaphoreSlim(0);
                _dispatcherEventRelease = Disposable.Create(() => _dispatcherEvent.Release());
            }
        }
Exemple #9
0
        /// <summary>
        /// Schedules an action to be executed.
        /// </summary>
        /// <param name="scheduler">Scheduler to execute the action on.</param>
        /// <param name="action">Action to execute.</param>
        /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
        /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
        public static IDisposable ScheduleLongRunning(this ISchedulerLongRunning scheduler, Action <ICancelable> action)
        {
            if (scheduler == null)
            {
                throw new ArgumentNullException(nameof(scheduler));
            }
            if (action == null)
            {
                throw new ArgumentNullException(nameof(action));
            }

            return(scheduler.ScheduleLongRunning(action, (a, c) => a(c)));
        }
Exemple #10
0
            public void Run(IEnumerable <TSource> source, ISchedulerLongRunning scheduler)
            {
                IEnumerator <TSource> e;

                try
                {
                    e = source.GetEnumerator();
                }
                catch (Exception exception)
                {
                    ForwardOnError(exception);

                    return;
                }

                SetUpstream(scheduler.ScheduleLongRunning((@this: this, e), static (tuple, cancelable) => [email protected](tuple.e, cancelable)));
Exemple #11
0
 public static IDisposable ScheduleLongRunning(this ISchedulerLongRunning scheduler, Action <ICancelable> action)
 {
     throw new NotImplementedException();
 }
Exemple #12
0
 public RangeLongRunning(int start, int count, ISchedulerLongRunning scheduler)
 {
     _start     = start;
     _count     = count;
     _scheduler = scheduler;
 }
Exemple #13
0
 public void Run(ISchedulerLongRunning scheduler)
 {
     SetUpstream(scheduler.ScheduleLongRunning(this, static (@this, cancel) => @this.Loop(cancel)));
 }
Exemple #14
0
 public CatchSchedulerLongRunning(ISchedulerLongRunning scheduler, Func <TException, bool> handler)
 {
     _scheduler = scheduler;
     _handler   = handler;
 }
Exemple #15
0
 public SchedulerLongRunning(IObservable <TSource> source, ISchedulerLongRunning scheduler)
 {
     _source    = source;
     _scheduler = scheduler;
 }
Exemple #16
0
 public ToObservableLongRunning(IEnumerable <TSource> source, ISchedulerLongRunning scheduler)
 {
     _source    = source;
     _scheduler = scheduler;
 }
Exemple #17
0
 public ObserveOnObserverLongRunning(ISchedulerLongRunning scheduler, IObserver <TSource> observer) : base(observer)
 {
     _scheduler    = scheduler;
     _queue        = new ConcurrentQueue <TSource>();
     _suspendGuard = new object();
 }
Exemple #18
0
 public ObserveOnObserverNew(IScheduler scheduler, IObserver <T> downstream) : base(downstream)
 {
     _scheduler   = scheduler;
     _longRunning = scheduler.AsLongRunning();
     _queue       = new ConcurrentQueue <T>();
 }
Exemple #19
0
 public void Run(ISchedulerLongRunning longRunning)
 {
     SetUpstream(longRunning.ScheduleLongRunning(this, static (@this, c) => @this.LoopInf(c)));
 }
Exemple #20
0
 public CountLongRunning(TResult value, int repeatCount, ISchedulerLongRunning scheduler)
 {
     _value       = value;
     _scheduler   = scheduler;
     _repeatCount = repeatCount;
 }
 public LongRunningEmitter(IObserver <TSource> observer, ISchedulerLongRunning scheduler)
 {
     _observer = observer;
     scheduler.ScheduleLongRunning(_ => Loop());
 }
Exemple #22
0
 public ForeverLongRunning(TResult value, ISchedulerLongRunning scheduler)
 {
     _value     = value;
     _scheduler = scheduler;
 }
Exemple #23
0
 public void Run(ISchedulerLongRunning longRunning)
 {
     SetUpstream(longRunning.ScheduleLongRunning(this, (@this, cancel) => @this.Loop(cancel)));
 }