C# 任务状态 WaitingForActivation - 这是什么意思?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9255187/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Task status WaitingForActivation - what does this mean?
提问by MonsterMMORPG
I am starting wpf tasks with the way below
我正在通过以下方式开始 wpf 任务
var newTask = Task.Factory.StartNew(() =>
{
fcStartSubPageCrawl(srMainSiteURL, srMainSiteId);
}).ContinueWith((t) =>
{
var aggException = t.Exception.Flatten();
foreach (var exception in aggException.InnerExceptions)
csPages.LogException(exception.ToString());
},
TaskContinuationOptions.OnlyOnFaulted);
Now when i check the task status
现在当我检查任务状态时
like this (new tasks assigned to task list) :
像这样(分配给任务列表的新任务):
if (tskLocalTaskList[i].IsCompleted == false)
I am seeing that task status = WaitingForActivation
我看到任务状态 = WaitingForActivation
what does this mean ? And why it is waiting activation ?
这是什么意思 ?为什么它在等待激活?
C# 4.0 WPF
C# 4.0 WPF
采纳答案by Polity
WaitingForActivation is the time the task resides between a call to the Start method and the moment in which the task gets scheduled by the Task scheduler. So directly after a call to the start method of a task, the tasks status is being set to WaitingForActivation and a call to scheduler.AddWork is made. In here, the Task is either scheduler (WaitingToRun) or run immidiatly.
WaitingForActivation 是任务在调用 Start 方法和任务调度程序调度任务之间的时间。因此,在调用任务的 start 方法之后,直接将任务状态设置为 WaitingForActivation 并调用 scheduler.AddWork。在这里,任务要么是调度程序(WaitingToRun)要么是立即运行。
Oh, and this has nothing to do with WPF, Tasks are a part of the BCL
哦,这与 WPF 无关,任务是 BCL 的一部分

