如何让在.NET 4.0中运行任务列表 [英] how to get a list of running tasks in .net 4.0

查看:253
本文介绍了如何让在.NET 4.0中运行任务列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让所有当前正在运行的任务列表。是否.NET 4.0 API任务提供这样的功能? ?还是唯一的选择是明确地在一个单独的集合店的任务

I'm trying to get a list of all currently running tasks. Does the .net 4.0 tasks api provide such functionality? Or the only option is explicitly to store tasks in a separate collection?

推荐答案

我想你需要的 TaskScheduler.GetScheduledTasks 方法,但是:

I suppose you need TaskScheduler.GetScheduledTasks method, but:


  1. 它的保护

  2. MSDN说,它应该只用于调试

  3. 就可以使用因为我知道这种方法只能通过ThreadPoolTask​​Scheduler实施,SynchronizationContextTaskScheduler始终返回null

所以,我认为你应该尝试实施的自己的TaskScheduler ,以实现自己的目标。

So I think you should try to implement own TaskScheduler to achieve your goals.

这篇关于如何让在.NET 4.0中运行任务列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆