private IDisposable Run(ISchedulerLongRunning scheduler) { if (_parent._repeatCount == null) { return(scheduler.ScheduleLongRunning(LoopInf)); } else { return(scheduler.ScheduleLongRunning(_parent._repeatCount.Value, Loop)); } }
public void Run() { if (_prepends == null) { SetUpstream(_source.SubscribeSafe(this)); } else { var disposable = _scheduler.ScheduleLongRunning(this, (@this, cancel) => @this.PrependValues(cancel)); Disposable.TrySetSingle(ref _schedulerDisposable, disposable); } }
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>())); }
/// <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))); }
public IDisposable ScheduleLongRunning <TState>(TState state, Action <TState, ICancelable> action) { return(_scheduler.ScheduleLongRunning(state, (state_, cancel) => { try { action(state_, cancel); } catch (TException exception) when(_handler(exception)) { } })); }
public IDisposable ScheduleLongRunning <TState>(TState state, Action <TState, ICancelable> action) { // Note that avoiding closure allocation here would introduce infinite generic recursion over the TState argument return(_scheduler.ScheduleLongRunning( state, (state1, cancel) => { try { action(state1, cancel); } catch (TException exception) when(_handler(exception)) { } })); }
private void EnsureDispatcher() { if (_dispatcherJob == null) { lock (_dispatcherInitGate) { if (_dispatcherJob == null) { _dispatcherJob = _longRunning.ScheduleLongRunning(Dispatch); _disposable.Disposable = StableCompositeDisposable.Create ( _dispatcherJob, _dispatcherEventRelease ); } } } }
private void Schedule() { // Schedule the suspending drain once if (Volatile.Read(ref _runDrainOnce) == 0 && Interlocked.CompareExchange(ref _runDrainOnce, 1, 0) == 0) { Disposable.SetSingle(ref _drainTask, _scheduler.ScheduleLongRunning(this, DrainLongRunning)); } // Indicate more work is to be done by the drain loop if (Interlocked.Increment(ref _wip) == 1L) { // resume the drain loop waiting on the guard lock (_suspendGuard) { Monitor.Pulse(_suspendGuard); } } }
private void EnsureDispatcher() { if (_dispatcherJob == null) { lock (_dispatcherInitGate) { if (_dispatcherJob == null) { _dispatcherJob = _longRunning.ScheduleLongRunning(Dispatch); _disposable.Disposable = new CompositeDisposable(2) { _dispatcherJob, Disposable.Create(() => _dispatcherEvent.Release()) }; } } } }
public void Run(ISchedulerLongRunning scheduler) { SetUpstream(scheduler.ScheduleLongRunning(this, static (@this, cancel) => @this.Loop(cancel))); }
public void Run(ISchedulerLongRunning longRunning) { SetUpstream(longRunning.ScheduleLongRunning(this, static (@this, c) => @this.LoopInf(c))); }
public LongRunningEmitter(IObserver <TSource> observer, ISchedulerLongRunning scheduler) { _observer = observer; scheduler.ScheduleLongRunning(_ => Loop()); }
public void Run(ISchedulerLongRunning longRunning) { SetUpstream(longRunning.ScheduleLongRunning(this, (@this, cancel) => @this.Loop(cancel))); }