This page on MSDN states that
If you do not use the overload which takes a scheduler as an argument, Rx will pick a default scheduler by using the principle of least concurrency. This means that the scheduler which introduces the least amount of concurrency that satisfies the needs of the operator is chosen. For example, for operators returning an observable with a finite and small number of messages, Rx calls Immediate. For operators returning a potentially large or infinite number of messages, CurrentThread is called. For operators which use timers, ThreadPool is used.
I would like to actually have a reference sheet for which observable operators use which default Scheduler, but I can't find one anywhere. What are the default Schedulers for each observable operator?
Wow, that was not trivial to find...
Deep within the bowels of the System.Reactive.Concurrency
namespace, there is an internal static class called SchedulerDefaults
, which is declared as:
internal static class SchedulerDefaults { internal static IScheduler AsyncConversions { get { return DefaultScheduler.Instance; }} internal static IScheduler ConstantTimeOperations { get { return ImmediateScheduler.Instance; }} internal static IScheduler Iteration { get { return CurrentThreadScheduler.Instance; }} internal static IScheduler TailRecursion { get { return ImmediateScheduler.Instance; }} internal static IScheduler TimeBasedOperations { get { return DefaultScheduler.Instance; }} }
AsyncConversions
is used by:
Start, ToAsync, FromAsyncPattern
ConstantTimeOperations
is used by:
Empty, GetSchedulerForCurrentContext, Return, StartWith, Throw
Iteration
is used by:
Generate, Range, Repeat, TakeLast, ToObservable, and the ReplaySubject<T>
TailRecursion
is used by:
Run
TimeBasedOperations
is used by:
Buffer, Delay, DelaySubscription, Generate, Interval, Sample, Skip, SkipLast SkipUntil, Take, TakeLast, TakeLastBuffer, TakeUntil, Throttle, TimeInterval, Timeout, Timer, Timestamp, Window
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With