.Net并发任务 [英] .Net concurrent Tasks
本文介绍了.Net并发任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找一种设置固定的并发任务编号的方法.
据我所知Task.Factory没有类似的东西,我被卡住了.
我也已经介绍了BlockingCollection和Producer-Consumer模型,但是我不确定这是否是正确的实现,因为我已经创建了约150个任务,并且我希望em以两个为两个开始.
谢谢
Hi,
I am looking for a way to set a Fixed concurrent tasks number..
As far as i know Task.Factory does not have anything like and i''m stuck.
I''ve also though about the BlockingCollection and the Producer-Consumer model but i''m not sure if this is the right implementation as i have about 150 created tasks and i want em to start two by two.
Thanks
推荐答案
看看ThreadPool类和TaskScheduler类.而且...我认为第三个链接可能是您正在寻找的一个很好的例子.
http://msdn.microsoft.com/en-us/library/system.threading. threadpool.aspx [ ^ ]
http://msdn.microsoft.com/en-us/library/system. threading.tasks.taskscheduler.aspx [ ^ ]
http://msdn.microsoft.com/en-us/library/ee789351.aspx [ ^ ]
祝你好运!
Have a look at the ThreadPool class and TaskScheduler class. And... I think the third link might be a good example of what you are looking for.
http://msdn.microsoft.com/en-us/library/system.threading.threadpool.aspx[^]
http://msdn.microsoft.com/en-us/library/system.threading.tasks.taskscheduler.aspx[^]
http://msdn.microsoft.com/en-us/library/ee789351.aspx[^]
Good luck!
这篇关于.Net并发任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文