Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
490 views
Welcome To Ask or Share your Answers For Others

1 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...