TPL-like library for .NET 2.0

我怕爱的太早我们不能终老 提交于 2019-12-23 20:15:30

问题


After discovering the Parallels library in .NET 4.0, I'd like to have something similar in my .NET 2.0 application.

Are there any parallel programming helper libraries for .NET 2.0, that simplify common tasks?


回答1:


Threadpool would be a nomination in .NET 2.0 which is kind of similar with TPL.

Provides a pool of threads that can be used to execute tasks, post work items, process asynchronous I/O, wait on behalf of other threads, and process timers.

TPL actually uses Threadpool under the hood:

TPL handles the partitioning of the work, the scheduling of threads on the ThreadPool, cancellation support, state management, and other low-level details.




回答2:


You can try the BackgroundWorker class which has been available from .NET Framework 2.0+. There is a lot of information available on how to use this class both on this site and on MSDN.

You can also look at the Thread class, which has been available from .NET Framework 1.1+. There is also a wealth of information on this class. One resource I particularly like is J. Albahari's page on threading. This should provide a great starting point for you to get started with these features.

I hope this helps.



来源:https://stackoverflow.com/questions/12386686/tpl-like-library-for-net-2-0

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