views:

34

answers:

1

I would like to limit the rate at which System.Threading.Tasks are run, so that only a set number of tasks are completed per second. I imagine I would need to Implement a TaskScheduler to do so but i am not sure how. Can any one give me an idea as to how to go about this.

+1  A: 

Take a look at the Parallel Extension Extras in the Parallel Samples. It includes a couple of TaskScheduler implementations which you could use as the basis for your custom scheduler.

That being said, if your only working with one set of tasks, you may be able to just set the MaximumConcurrencyLevel on the default TaskScheduler instead of implementing your own.

Reed Copsey