I have a collection which has elements to be processed and at max only four elements can be processed together. At run time all process started together and all goes in waiting state. Only four elements are processed at one time.
Problem is the processing elements are chosen randomly as all threads are waiting for resources to get free. Means first element can be the last one from collection.
But, I need to process elements in order they are in the collection.
Please tell me how can I achieve this?
I am using TPL and C# 4.0
This is how I acheived this task
Thanks..