Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Task status WaitingForActivation - what does this mean?

Tags:

c#

task

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

like image 908
MonsterMMORPG Avatar asked Feb 13 '12 03:02

MonsterMMORPG


1 Answers

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

like image 116
Polity Avatar answered Nov 15 '22 19:11

Polity