Will Reactive Extensions (Rx) supersede the Task Parallel Library?

感情迁移 提交于 2019-12-10 02:56:12

问题


After following through the samples of Rx.NET, I'm gob smacked at how brilliant the concept and implementation of Reactive Extensions are. It appears to offer developers a more maintainable pattern for achieving the same sort of multi-threaded parallel coding that .NET 4.0's task parallel library offers.

Will Rx.NET supersede TPL? Should it?


回答1:


In short, no.

The Task Parallel Library (TPL) provides provides distribution of work (concurrency), as well as the concurrent optimisation of larger work (parallelism) while abstracting the actual mechanism of work distribution (threads).

C# adds the async keyword to help manage asynchrony from a language level. Rx has already been updated to support this feature.

Rx provides a framework to compose and manage asynchronous data streams using standard operators. While there is some crossover in Rx's use of schedulers, this is only an abstraction. In fact, the recommended scheduler for parallelism is the TaskScheduler, which uses the TPL.

See also Jeffrey van Gogh's response to the exact opposite question on the Rx forums.

Also, this question may be of use.



来源:https://stackoverflow.com/questions/4105206/will-reactive-extensions-rx-supersede-the-task-parallel-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!