任务状态WaitingForActivati​​on - 这是什么意思? [英] Task status WaitingForActivation - what does this mean?

查看:1505
本文介绍了任务状态WaitingForActivati​​on - 这是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始WPF任务,低于

  VAR newTask = Task.Factory.StartNew(()=>的样子; 
{
fcStartSubPageCrawl(srMainSiteURL,srMainSiteId);
}。)ContinueWith((T)=>
{
变种aggException = t.Exception.Flatten() ;
的foreach(在aggException.InnerExceptions变种除外)
csPages.LogException(exception.ToString());
},
TaskContinuationOptions.OnlyOnFaulted);

现在当我检查任务状态



这样的(分配到任务列表新任务):

 如果(tskLocalTask​​List [I] .IsCompleted ==假)

我看到那个任务状态= WaitingForActivati​​on



这是什么意思 ?以及为什么它正在等待激活?



C#4.0 WPF


解决方案

WaitingForActivati​​on是任务所在的启动方法的调用,并在该任务获取任务调度计划的时刻之间的时间。所以直接到任务的启动方法的调用后,任务状态被设置为WaitingForActivati​​on和scheduler.AddWork一个调用。在这里,任务或者是调度器(WaitingToRun)或immidiatly运行。



呵呵,这已无关WPF,任务是BCL

I am starting wpf tasks with the way below

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

what does this mean ? And why it is waiting activation ?

C# 4.0 WPF

解决方案

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.

Oh, and this has nothing to do with WPF, Tasks are a part of the BCL

这篇关于任务状态WaitingForActivati​​on - 这是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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