Building Automation framework using Task Parallel Library (TPL)
Solution
I was reading the new features of .Net 4.0, there I was struck with a topic which really interested me, that’s TPL which is Task Parallel Library, wow, that was awesome.
To me that’s really interesting since it unlocked the problem which I was facing for sometimes.
About Task Parallel Library
TPL enhances multithreaded programming in two ways.
- It simplifies the creation and use of multiple threads
- It automatically make use of multiple processors, which means you can scale your application to make use of multiple cores of processors available.
TPL is defined in System.Threading.Task Library.
I cannot outsource the whole code but here is the code snippet which will best demonstrate how the code can be written and implemented in your framework.
The above code while executed will give the result as shown below
As you could see the execution is happening parallel for both UI and Validation.
The above code is not the actual code which can be implemented for parallel processing, since its just an idea and example of how we can implement it in a very simple way by leveraging the power of TPL.
For any queries and clarifications, please mail me @ Karthik@techgeek.co.in or leave your comments in blog.
No comments:
Post a Comment