I heard that the Task Parallel Library can be used in a .Net 3.5 project. Is this correct, and if yes, how do I use it? In .Net 4.0, it resides in System.Threading, but when I select .Net 3.5 as the target in Visual Studio 2010, I don't get access to classes like Parallel and the Parallel loops.
The Task Parallel Library (TPL) is a set of public types and APIs in the System. Threading and System. Threading. Tasks namespaces. The purpose of the TPL is to make developers more productive by simplifying the process of adding parallelism and concurrency to applications.
Third Party Liability (TPL) refers to the legal obligation of third parties (for example, certain individuals, entities, insurers, or programs) to pay part or all of the expenditures for medical assistance furnished under a Medicaid state plan.
Compared to the classic threading model in . NET, Task Parallel Library minimizes the complexity of using threads and provides an abstraction through a set of APIs that help developers focus more on the application program instead of focusing on how the threads will be provisioned.
(Legacy answer - it seems the backport for 3.5 is no longer readily available.)
You can't use the full Parallel Extensions, no...
... but if you install Reactive Extensions for .NET 3.5, that comes with a version of Parallel Extensions, so you can use that. I don't know how much of PFX is supported, but I suspect there's enough for most people. (There are some details in the blog post, but that was from 2009... I don't know about any changes in 2010 which may or may not have been backported.)
Note that this is unsupported, too - probably fine for hobby projects, but if I wanted to use PFX commercially, I'd upgrade to .NET 4.
As Jon Skeet mentioned, Rx
backported TPL
to .NET 3.5
.
I have made a nuget (called TaskParallelLibrary) out of their System.Threading.dll
, for easier integration.
You can get it from http://nuget.org/packages/TaskParallelLibrary.
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