O'Reilly logo

Programming Reactive Extensions and LINQ by Paul Betts, Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Schedulers

Operators that care about concurrency will take an IScheduler as a parameter. This lets you specify the context in which the operator will run.

Normally, and for most operators in Rx (and in LINQ), you specify what will happen, but not the context in which it will happen. Rx generally frees you from caring. This is very different from traditional imperative programming in which all synchronization is explicit, and you must manage all the elements of asynchronous programming, such as the creation of threads and locks. In traditional programming your code never suddenly runs in a background thread; you make that happen programmatically.

Rx changes that. Every time you write some code that runs in a Select() or Where() operator, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required